# もう一度やる # 入次数0の頂点から調べて、スイッチを押していく # その頂点を調べて、スイッチを押したらnxt頂点のonoffも調整 # そうしたらnxt頂点の次数を1つ減らす、次数が0になったら調べるリストに入れる N, M = map(int, input().split()) A = [0]+list(map(int, input().split())) edges = [[] for i in range(N+1)] inward = [0]*(N+1) for i in range(M): u, v = map(int, input().split()) if A[u] < A[v]: edges[u].append(v) inward[v] += 1 elif A[u] > A[v]: edges[v].append(u) inward[u] += 1 K = int(input()) B = list(map(int, input().split())) on_off = [0]*(N+1) for b in B: on_off[b] = 1 from collections import deque que = deque() for i in range(1, N+1): if inward[i] == 0: que.append(i) ans = [] while que: current = que.popleft() if on_off[current] == 0: for nxt in edges[current]: inward[nxt] -= 1 if inward[nxt] == 0: que.append(nxt) elif on_off[current] == 1: ans.append(current) for nxt in edges[current]: on_off[nxt] ^= 1 inward[nxt] -= 1 if inward[nxt] == 0: que.append(nxt) print(len(ans)) for a in ans: print(a)