fn main() { let mut nm = String::new(); std::io::stdin().read_line(&mut nm).ok(); let nm: Vec = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nm[0]; let m = nm[1]; let mut a = String::new(); std::io::stdin().read_line(&mut a).ok(); let a: Vec = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let mut paths = vec![vec![]; n]; for _ in 0..m { let mut uv = String::new(); std::io::stdin().read_line(&mut uv).ok(); let uv: Vec = uv.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let u = uv[0]-1; let v = uv[1]-1; if a[u] < a[v] { paths[u].push(v); } if a[v] < a[u] { paths[v].push(u); } } let mut k = String::new(); std::io::stdin().read_line(&mut k).ok(); let k: usize = k.trim().parse().unwrap(); let mut b = String::new(); std::io::stdin().read_line(&mut b).ok(); let b: Vec = b.trim().split_whitespace().map(|s| s.parse::().unwrap()-1).collect(); let mut lamps = vec![0usize; n]; for &v in b.iter() { lamps[v] = 1; } let mut a = (0..n).map(|i| (a[i], i)).collect::>(); a.sort(); let mut result = vec![]; for &(_, u) in a.iter() { if lamps[u] == 0 { continue; } result.push(u); lamps[u] = 0; for &v in paths[u].iter() { lamps[v] = 1 - lamps[v]; } } if lamps.iter().sum::() == 0 { println!("{}", result.len()); for &v in result.iter() { println!("{}", v+1); } } else { println!("-1"); } }