import sys from heapq import heappop,heappush,heapify sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N,M = MI() A = [0]+LI() Graph = [[] for _ in range(N+1)] for _ in range(M): u,v = MI() Graph[u].append(v) Graph[v].append(u) K = I() B = LI() C = [] is_light = [0]*(N+1) for b in B: heappush(C,(A[b],b)) is_light[b] = 1 ANS = [] while C: a,u = heappop(C) if not is_light[u]: continue ANS.append(u) is_light[u] = 0 for v in Graph[u]: if a < A[v]: is_light[v] ^= 1 if is_light[v]: heappush(C,(A[v],v)) print(len(ANS)) print(*ANS,sep='\n')