using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, m) = (c[0], c[1]); var a = NList; var map = NArr(m); var k = NN; var b = NList; var vlist = new (int id, int a)[n]; for (var i = 0; i < n; ++i) vlist[i] = (i, a[i]); Array.Sort(vlist, (l, r) => l.a.CompareTo(r.a)); var tree = new List[n]; for (var i = 0; i < tree.Length; ++i) tree[i] = new List(); foreach (var edge in map) { tree[edge[0] - 1].Add(edge[1] - 1); tree[edge[1] - 1].Add(edge[0] - 1); } var lamp = new bool[n]; foreach (var bi in b) lamp[bi - 1] = true; var ans = new List(); foreach (var v in vlist) { if (lamp[v.id]) { ans.Add(v.id); lamp[v.id] = false; foreach (var next in tree[v.id]) { lamp[next] = !lamp[next]; } } } WriteLine(ans.Count); WriteLine(string.Join("\n", ans.Select(ai => ai + 1))); } }