from collections import defaultdict, deque n, m = map(int, input().split()) A = list(map(int, input().split())) IN = [0 for _ in range(n)] G = defaultdict(list) for _ in range(m): u, v = map(int, input().split()) u -= 1 v -= 1 if A[u] > A[v]: G[v].append(u) IN[u] += 1 elif A[u] < A[v]: G[u].append(v) IN[v] += 1 Que = deque([i for i in range(n) if IN[i] == 0]) k = int(input()) B = list(map(int, input().split())) L = [0 for _ in range(n)] for i in range(k): L[B[i] - 1] = 1 ANS = [] while Que: idx, on = Que.popleft() if L[idx] == 1: ANS.append(idx + 1) for nidx in G[idx]: IN[nidx] -= 1 L[nidx] ^= L[idx] if IN[nidx] == 0: Que.append((nidx, on)) L[idx] = 0 print(len(ANS)) print(*ANS, sep='\n')