import sys from collections import deque, Counter input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 63 - 1 mod = 998244353 import heapq class Heap(): def __init__(self, maxi = False): self.sum = 0 self.al = [] self.maxi = maxi self.len = 0 def __len__(self): return len(self.al) def add(self, x): if self.maxi: heapq.heappush(self.al, -x) else: heapq.heappush(self.al, x) def pop(self): if self.maxi: now = heapq.heappop(self.al) return -now else: now = heapq.heappop(self.al) return now def top(self): now = self.pop() self.add(now) return now n, m = mi() a = li() graph = [[] for _ in range(n)] for _ in range(m): u, v = mi() u -= 1; v -= 1 graph[u].append(v) graph[v].append(u) k = li() b = li() H = Heap() color = [0] * n for v in b: color[v - 1] = 1 H.add((a[v - 1], v - 1)) ans = [] while H: nowa, now = H.pop() if color[now] == 0: continue color[now] = 0 ans.append(now + 1) for to in graph[now]: if a[now] < a[to]: color[to] ^= 1 if color[to] == 1: H.add((a[to], to)) print(len(ans)) for v in ans: print(v)