#include "bits/stdc++.h" //#include "atcoder/all" using namespace std; //using namespace atcoder; //using mint = modint1000000007; //const int mod = 1000000007; //using mint = modint998244353; //const int mod = 998244353; //const int INF = 1e9; //const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n-1); i >= 0; --i) #define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define endl "\n" vectorto[100005]; std::vectortopological_sort(int V) { std::vectorh(V); for (int i = 0; i < V; ++i) for (auto e : to[i]) ++h[e]; std::stackst; std::vectorans; for (int i = 0; i < V; ++i) if (h[i] == 0) st.push(i); while (!st.empty()) { int v = st.top(); st.pop(); ans.push_back(v); for (auto u : to[v]) { --h[u]; if (h[u] == 0) st.push(u); } } return ans; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vectora(n); rep(i, n) cin >> a[i]; rep(i, m) { int u, v; cin >> u >> v; u--; v--; int x = a[u]; int y = a[v]; if (x > y) to[v].push_back(u); else if (x < y) to[u].push_back(v); } vectorb(n);//false消灯 int k; cin >> k; rep(i, k) { int num; cin >> num; num--; b[num] = true; } auto sv = topological_sort(n); vectorvans; rep(i, n) { if (!b[sv[i]]) continue; b[sv[i]] = false; vans.push_back(sv[i] + 1); for (auto v : to[sv[i]]) b[v] = !b[v]; } cout << vans.size() << endl; rep(i, vans.size()) cout << vans[i] << endl; return 0; }