import heapq import sys input = sys.stdin.readline n, m = map(int, input().split()) a = list(map(int, input().split())) adj = [[] for _ in range(n)] for _ in range(m): u, v = map(int, input().split()) u -= 1 v -= 1 if a[u] < a[v]: adj[u].append(v) if a[v] < a[u]: adj[v].append(u) _ = int(input()) b = list(map(int, input().split())) onoff = [(i + 1 in b) for i in range(n)] hq = [(a[i - 1], i - 1) for i in b] heapq.heapify(hq) ans = [] while hq: x, y = heapq.heappop(hq) if not onoff[y]: continue ans.append(y + 1) onoff[y] = False for v in adj[y]: onoff[v] = not onoff[v] if onoff[v]: heapq.heappush(hq, (a[v], v)) print(len(ans)) print(*ans, sep='\n')