import sys readline = sys.stdin.readline N,M = map(int,readline().split()) A = list(map(int,readline().split())) G = [[] for i in range(N)] indegree = [0] * N for _ in range(M): u,v = map(int,readline().split()) u -= 1 v -= 1 if A[u] < A[v]: G[u].append(v) indegree[v] += 1 if A[u] > A[v]: G[v].append(u) indegree[u] += 1 starts = [] for i in range(N): if indegree[i] == 0: starts.append(i) K = int(readline()) B = list(map(int,readline().split())) lamp_on = [False] * N for b in B: lamp_on[b - 1] = True ans = [] while starts: next_starts = [] for s in starts: if lamp_on[s]: lamp_on[s] = False ans.append(s) for child in G[s]: lamp_on[child] ^= True for child in G[s]: indegree[child] -= 1 if indegree[child] == 0: next_starts.append(child) starts = next_starts print(len(ans)) for a in ans: print(a + 1)