import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; 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]; List> graph = new ArrayList<>(); for (int i = 0; i < n; i++) { values[i] = sc.nextInt(); graph.add(new ArrayList<>()); } for (int i = 1; i <= m; i++) { int left = sc.nextInt() - 1; int right = sc.nextInt() - 1; if (values[left] < values[right]) { graph.get(left).add(right); } else if (values[left] > values[right]) { graph.get(right).add(left); } } int k = sc.nextInt(); TreeSet queue = new TreeSet<>((a, b) -> values[a] - values[b]); while (k-- > 0) { queue.add(sc.nextInt() - 1); } List ans = new ArrayList<>(); while (queue.size() > 0) { int x = queue.pollFirst(); ans.add(x + 1); for (int y : graph.get(x)) { if (queue.contains(y)) { queue.remove(y); } else { queue.add(y); } } } System.out.println(ans.size()); System.out.println(ans.stream().map(x -> x.toString()).collect(Collectors.joining("\n"))); } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }