from heapq import heapify, heappop, heappush N,M = map(int,input().split()) A = list(map(int,input().split())) G = [[] for _ in range(N)] for i in range(M): u,v = map(int,input().split()) u-=1;v-=1 G[u].append(v) G[v].append(u) K = int(input()) B = list(map(int,input().split())) B = [b-1 for b in B] Status = [0]*N HQ = [] for b in B: Status[b] = 1 for i in range(N): if Status[i] == 1: heappush(HQ,(A[i],i)) #value, index ret = [] while HQ: val,idx = heappop(HQ) if Status[idx] == 0: #消灯していたらスキップ continue Status[idx] = 0 ret.append(idx+1) #1index for adj in G[idx]: if A[adj] > A[idx]: if Status[adj] == 0: Status[adj] = 1 heappush(HQ,(A[adj],adj)) else: Status[adj] = 0 print(len(ret)) print(*ret,sep="\n")