#include #include using namespace std; using LL = long long; using P = pair; using Graph = vector>; const int INF = 1 << 29; const long long LINF = 1LL << 60; #define all(x) (x).begin(), (x).end() #define rep(i,n) for(int i = 0; i < (n); ++i) templatevoid chmin(T&a, T b){if(a > b) a = b;} templatevoid chmax(T&a, T b){if(a < b) a = b;} int main(){ int N, M; cin >> N >> M; vector

A(N); vector points(N); for(int i = 0; i < N; ++i){ int tmp; cin >> tmp; points[i] = tmp; A[i] = make_pair(tmp, i); } sort(A.begin(), A.end()); Graph G(N); for(int i = 0; i < M; ++i){ int u, v; cin >> u >> v; --u; --v; G[u].push_back(v); G[v].push_back(u); } vector state(N, false); int K; cin >> K; for(int i = 0; i < K; ++i){ int tmp; cin >> tmp; state[tmp-1] = true; } vector ans; for(int i = 0; i < N; ++i){ int now_point = A[i].first; int now_num = A[i].second; if(state[now_num]){ ans.push_back(now_num); state[now_num] = false; for(auto next_num : G[now_num]){ int next_point = points[next_num]; if(now_point < next_point){ if(state[next_num]) state[next_num] = false; else state[next_num] = true; } } } } for(auto b : state) if(b == true) {cout << -1 << endl; return 0;} cout << ans.size() << endl; for(auto v : ans) cout << v+1 << endl; }