import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); int[] values = new int[n]; Lamp[] lamps = new Lamp[n]; ArrayList> graph = new ArrayList<>(); for (int i = 0; i < n; i++) { values[i] = sc.nextInt(); lamps[i] = new Lamp(i, values[i]); graph.add(new ArrayList<>()); } for (int i = 0; i < m; i++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; if (values[a] < values[b]) { graph.get(a).add(b); } if (values[b] < values[a]) { graph.get(b).add(a); } } int k = sc.nextInt(); boolean[] ons = new boolean[n]; for (int i = 0; i < k; i++) { ons[sc.nextInt() - 1] = true; } Arrays.sort(lamps); ArrayList ans = new ArrayList<>(); for (Lamp x : lamps) { if (ons[x.idx]) { ans.add(x.idx + 1); for (int y : graph.get(x.idx)) { ons[y] ^= true; } } } StringBuilder sb = new StringBuilder(); sb.append(ans.size()).append("\n"); for (int x : ans) { sb.append(x).append("\n"); } System.out.print(sb); } static class Lamp implements Comparable { int idx; int value; public Lamp(int idx, int value) { this.idx = idx; this.value = value; } public int compareTo(Lamp another) { return value - another.value; } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }