#include using namespace std; //#define int long long #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) #define pb push_back #define all(a) a.begin(),a.end() #define rall(c) (c).rbegin(),(c).rend() #define mp make_pair #define endl '\n' #define vec vector #define mat vector > #define fi first #define se second #define double long double typedef long long ll; typedef unsigned long long ull; typedef pair pll; //typedef long double ld; typedef complex Complex; const ll INF=1e9+7; const ll MOD=998244353; const ll inf=INF*INF; const ll mod=MOD; const ll MAX=200010; signed main(){ ll n,m;cin>>n>>m; vectora(n); vector >G(n); rep(i,n)cin>>a[i]; rep(i,m){ ll u,v;cin>>u>>v; u--;v--; if(a[u]>k; priority_queue,greater >q; vectorl(n); rep(i,k){ ll b;cin>>b; b--; l[b]=1; q.push(mp(a[b],b)); } vectorans(0); while(!q.empty()){ pll p=q.top(); ll d=p.se; q.pop(); if(l[d]==0)continue; l[d]=0; ans.pb(d+1); for(auto e:G[d]){ l[e]=1-l[e]; if(l[e]){ q.push(mp(a[e],e)); } } } cout<