use std::io::Write; fn main() { let ref mut buf = Vec::new(); std::io::Read::read_to_end(&mut std::io::stdin(), buf).ok(); let mut iter = std::str::from_utf8(buf).unwrap().split_whitespace(); macro_rules! scan { ([$t:tt; $n:expr]) => ((0..$n).map(|_| scan!($t)).collect::>()); (($($t:tt),*)) => (($(scan!($t)),*)); (Usize1) => (scan!(usize) - 1); (Bytes) => (scan!(String).into_bytes()); ($t:ty) => (iter.next().unwrap().parse::<$t>().unwrap()); } let (n, m) = scan!((usize, usize)); let a = scan!([u32; n]); let mut g = vec![vec![]; n]; for _ in 0..m { let (u, v) = scan!((Usize1, Usize1)); g[u].push(v); g[v].push(u); } let k = scan!(usize); let mut lit = vec![false; n]; for _ in 0..k { let b = scan!(Usize1); lit[b] = true; } let mut ord = (0..n).collect::>(); ord.sort_by_key(|&i| a[i]); let mut ans = vec![]; for from in ord { if !lit[from] { continue; } ans.push(from); for &to in &g[from] { if a[from] < a[to] { lit[to] ^= true; } } } let stdout = std::io::stdout(); let mut writer = std::io::BufWriter::new(stdout.lock()); writeln!(writer, "{}", ans.len()).ok(); for ans in ans { writeln!(writer, "{}", ans + 1).ok(); } }