#include #include #include #include #include #include #include #include #include #include #define _USE_MATH_DEFINES #include #include #include #include #include using namespace std; #include using namespace atcoder; #define rep(i,x) for(ll i=0;i P; const ll INF = 1e17; const ll MAX = 4000001; const long double eps = 1E-14; ll max(ll a, ll b) { if (a > b) { return a; } return b; } ll min(ll a, ll b) { if (a > b) { return b; } return a; } ll gcd(ll a, ll b) { if (b == 0) { return a; } if (a < b) { return gcd(b, a); } return gcd(b, a % b); } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } struct edge { ll id; ll fr; ll to; ll d; }; using mint = modint; typedef vector vll; typedef vector > vvll; typedef vector>> vvvll; typedef vector vmint; typedef vector> vvmint; typedef vector>> vvvmint; vmint f, finv, inv; void cominit(ll N) { ll MOD = modint::mod();//デフォルトが998244353に注意 f.assign(N + 1, 1); finv.assign(N + 1, 1); inv.assign(N + 1, 1); inv[1] = 1; repn(i, N) { f[i] = f[i - 1] * i; if (i > 1)inv[i] = -inv[MOD % i] * (MOD / i); finv[i] = finv[i - 1] * inv[i]; } } mint com(ll a, ll b) { if (a < 0 || b < 0 || a < b) { return 0; } return f[a] * finv[b] * finv[a - b]; } ///////////////////////////////////// int main() { ll N, M; cin >> N >> M; vll A(N); rep(i, N)cin >> A[i]; vvll g(N); rep(i, M) { ll u, v; cin >> u >> v; u--; v--; if (A[u] < A[v]) { g[u].push_back(v); } if (A[u] > A[v]) { g[v].push_back(u); } } vll on(N); ll K; cin >> K; rep(i, K) { ll b; cin >> b; on[b - 1]++; } vector

p(N); rep(i, N)p[i] = { A[i],i }; sort(p.begin(), p.end()); vll lis; rep(i, N) { ll x = p[i].second; if (on[x] == 0) { continue; } lis.push_back(x); for (ll y : g[x]) { on[y] = 1 - on[x]; } } cout << lis.size() << endl; for (ll x : lis) { cout << x+1 << endl; } }