from collections import defaultdict, deque
II = lambda : int(input())
MII = lambda : map(int, input().split())
n, m = MII()
adj = defaultdict(list)
for _ in range(m):
u, v = MII()
adj[u - 1].append(v - 1)
adj[v - 1].append(u - 1)
a = list(MII())
q = deque()
st = [0] * n
cnt = [0] * n
for i, [x, y] in enumerate(zip(cnt, a)):
if x == y: q.append(i)
while len(q):
v = q.popleft()
st[v] = 1
cnt[v] += 1
for nxt in adj[v]:
cnt[nxt] += 1
if cnt[nxt] == a[nxt] and st[nxt] == 0:
st[nxt] = 1
q.append(nxt)
if len(q): print(-1)
else:
print(sum(st))
print(*[i + 1 for i, x in enumerate(st) if x])
2148. Count Elements With Strictly Smaller and Greater Elements | 2149. Rearrange Array Elements by Sign |
2150. Find All Lonely Numbers in the Array | 2151. Maximum Good People Based on Statements |
2144. Minimum Cost of Buying Candies With Discount | Non empty subsets |
1630A - And Matching | 1630B - Range and Partition |
1630C - Paint the Middle | 1630D - Flipping Range |
1328A - Divisibility Problem | 339A - Helpful Maths |
4A - Watermelon | 476A - Dreamoon and Stairs |
1409A - Yet Another Two Integers Problem | 977A - Wrong Subtraction |
263A - Beautiful Matrix | 180C - Letter |
151A - Soft Drinking | 1352A - Sum of Round Numbers |
281A - Word Capitalization | 1646A - Square Counting |
266A - Stones on the Table | 61A - Ultra-Fast Mathematician |
148A - Insomnia cure | 1650A - Deletions of Two Adjacent Letters |
1512A - Spy Detected | 282A - Bit++ |
69A - Young Physicist | 1651A - Playoff |