N,M = map(int,input().split()) A = list(map(int,input().split())) G = [[] for _ in range(N+1)] for _ in range(M): u,v = map(int,input().split()) if A[u-1] < A[v-1]: G[u].append(v) elif A[u-1] > A[v-1]: G[v].append(u) K = int(input()) B = list(map(int,input().split())) memo = [False] * (N + 1) for b in B: memo[b] = True import heapq q = [(A[b-1],b) for b in B] heapq.heapify(q) ans = [] while (len(q)): a,b = heapq.heappop(q) if memo[b] == False: continue ans.append(b) memo[b] = False for v in G[b]: memo[v] = not memo[v] if memo[v]: heapq.heappush(q,(A[v-1],v)) print(len(ans)) for a in ans: print(a)