package yukicoder; import java.util.Scanner; import java.util.List; import java.util.ArrayList; public class No1477 { private static class Peek { public int i, A; public List V; public boolean B; public Peek(int i, int A) { this.i = i; this.A = A; V = new ArrayList(); B = false; } } public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int M = scan.nextInt(); Peek[] A = new Peek[N]; for (int i=0; i < N; i++) { A[i] = new Peek(i, scan.nextInt()); } for (int i = 0; i < M; i++) { int u = scan.nextInt() - 1; int v = scan.nextInt() - 1; A[u].V.add(v); A[v].V.add(u); } int K = scan.nextInt(); for (int i = 0; i < K; i++) { int b = scan.nextInt() - 1; A[b].B = true; } scan.close(); List S = new ArrayList(); for (Peek p : A) { boolean noInput = true; for (int i : p.V) { if (p.A > A[i].A) { noInput = false; } else if (p.A == A[i].A) { p.V.remove((Object)i); } } if (noInput) { S.add(p); } } List op = new ArrayList(); while(!S.isEmpty()) { Peek n = S.remove(0); boolean b = n.B; if (b) { n.B = false; op.add(n.i + 1); } for (int i : n.V) { Peek m = A[i]; m.V.remove((Object)n.i); if (b) { m.B = !m.B; } boolean noInput = true; for (int j : m.V) { if (m.A > A[j].A) { noInput = false; } else if (m.A == A[j].A) { m.V.remove((Object)j); } } if (noInput) { S.add(m); } } } boolean b = false; for (Peek p : A) { b |= p.B; } if (b) { System.out.println(-1); } else { System.out.println(op.size()); for (int p : op) { System.out.println(p); } } } }