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(); Path[] lights = new Path[n]; ArrayList> graph = new ArrayList<>(); for (int i = 0; i < n; i++) { lights[i] = new Path(i, sc.nextInt()); graph.add(new ArrayList<>()); } for (int i = 0; i < m; i++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; if (lights[a].value > lights[b].value) { graph.get(b).add(a); } else if (lights[a].value < lights[b].value) { graph.get(a).add(b); } } Arrays.sort(lights); boolean[] isOn = new boolean[n]; int k = sc.nextInt(); while (k-- > 0) { isOn[sc.nextInt() - 1] = true; } StringBuilder sb = new StringBuilder(); int count = 0; for (Path x : lights) { if (!isOn[x.idx]) { continue; } sb.append(x.idx + 1).append("\n"); count++; for (int y : graph.get(x.idx)) { isOn[y] ^= true; } } System.out.println(count); System.out.print(sb); } static class Path implements Comparable { int idx; int value; public Path(int idx, int value) { this.idx = idx; this.value = value; } public int compareTo(Path 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 double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }