import os,io,heapq input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline n,m=map(int,input().split()) a=list(map(int,input().split())) graph=[] for i in range(n): graph.append([]) for i in range(m): c,d=map(int,input().split()) graph[c-1].append(d-1) graph[d-1].append(c-1) k=int(input()) b=list(map(int,input().split())) queue=[] for i in range(n): queue.append((a[i],i+1)) queue.sort() ans=[] lights=[0]*n for i in range(k): lights[b[i]-1]=1 for i in range(n): val,pos=queue[i] if lights[pos-1]==1: ans.append(pos) for j in graph[pos-1]: if a[j]>val: lights[j]=1-lights[j] print(len(ans)) for i in ans: print(i)