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(); List values = Stream.generate(sc::nextInt).limit(n).toList(); List> graph = IntStream.range(0, n).mapToObj(i -> new ArrayList()).collect(Collectors.toList()); IntStream.range(0, m).forEach(i -> { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; if (values.get(a) < values.get(b)) { graph.get(a).add(b); } else if (values.get(b) < values.get(a)) { graph.get(b).add(a); } }); boolean[] isOn = new boolean[n]; IntStream.range(0, sc.nextInt()).forEach(i -> { isOn[sc.nextInt() - 1] = true; }); List ans = new ArrayList<>(); IntStream.range(0, n).forEach(i -> { if (isOn[i]) { ans.add(i + 1); graph.get(i).stream().forEach(x -> isOn[x] ^= true); } }); 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(); } } }