#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N =1e9;
int n, q, sss;
int a[500005],ss[710];
set<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
	if (n>1000)sss=int(sqrt(n))*3;
	if(n>2 && n < 100)sss =   int(sqrt(n))-1;
	else sss=   int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N = 1e9;
int n, q, sss;
int a[500005],ss[710];
multiset<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   // freopen("input.txt", "r", stdin);
  //  freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
	sss =   int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N =1e9;
int n, q, sss;
int a[500005],ss[710];
set<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   // freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
	if(n>2)sss =   int(sqrt(n))-1;
	else sss=   int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N = 1e9;
int n, q, sss;
int a[500005],ss[710];
set<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   // freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
	sss =   int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N =1e9;
int n, q, sss;
int a[500005],ss[710];
set<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   // freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
	if(n>2)sss =   int(sqrt(n))-1;
	else sss=   int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N =1e9;
int n, q, sss;
int a[500005],ss[710];
multiset<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   // freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
	if(n>2 && n < 100)sss =   int(sqrt(n))-1;
	else sss=   int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N = 1e9;
int n, q, sss;
int a[500005],ss[710];
set<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  //  freopen("input.txt", "r", stdin);
  //  freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
	sss =  3*int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N =1e9;
int n, q, sss;
int a[500005],ss[710];
set<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
	int j = 0;
	sss =   int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N =1e9;
int n, q, sss;
int a[500005],ss[710];
set<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
	if (n>1000)sss=int(sqrt(n))*5;
	if(n>2 && n < 100)sss =   int(sqrt(n))-1;
	else sss=   int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


/*
Nahid Hossain
Jahangirnagar University
Roll:54
*/
#include<bits/stdc++.h>
#define ll          long long int
#define db          double
#define pf          printf
#define sf          scanf
#define ff          first
#define ss          second
#define clr         clear()
#define sz          size()
#define pb          push_back
#define mk          make_pair
#define pi          acos(-1)
#define inf         123456789
#define mod         1000000007
#define ull         unsigned long long int
#define f(i,k,n)    for(ll i=k;i<n;i++)
#define fr(i,n,k)   for(i=n;i>=k;i--)
#define ent(a)      scanf("%lld",&a)
#define ent2(a,b)   scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a)      memset(a,0,sizeof(a))
#define vec(v,s)    vector<ll>v[s]
#define arr(a,s)    ll a[s];
//#define check(n,pos) (n&(1<<pos))
//#define set(n,pos)  (n|(1<<pos))
//knight and king//
int dr[]= {2, 2, -2, -2, 1, -1, 1, -1};
int dc[]= {1,-1,  1, -1, 2,  2,-2, -2};
int dr1[]= {0, 0, 0, 1, 1, 1, -1, -1, -1};
int dc1[]= {-1,0, 1,-1, 0, 1, -1, 0,   1};
int dr2[]= {0, 0, 1, -1};
int dc2[]= {1,-1, 0,  0};
////////////////////////////
using namespace std;

#define ma 710
#define ma1 10000000000000
vector<pair<ll,ll> >adj[ma];
ll up[ma];

ll update1(ll seg,ll x,ll val)
{
 ll i;
 for(i=0;i<adj[seg].sz;i++)
 {
  if(adj[seg][i].ss>=x)adj[seg][i].ff+=val;
 }
 sort(adj[seg].begin(),adj[seg].end());
}

ll update2(ll seg,ll x,ll val)
{
 ll i;
 for(i=0;i<adj[seg].sz;i++)
 {
  if(adj[seg][i].ss<=x)adj[seg][i].ff+=val;
 }
 sort(adj[seg].begin(),adj[seg].end());
}

ll update3(ll seg,ll f,ll l,ll v)
{
 ll i;
 for(i=0;i<adj[seg].sz;i++)
 {
  if(adj[seg][i].ss>=f&&adj[seg][i].ss<=l)adj[seg][i].ff+=v;
 }
}

ll query(ll x,ll s)
{
 ll i;
 for(i=1;i<=s;i++)
 {
  ll p=x-up[i];
  ll lo=0,hi=adj[i].sz-1,mid,ans=-1;
  while(lo<=hi)
  {
   mid=(lo+hi)>>1;
   if(adj[i][mid].ff<p)lo=mid+1;
   else if(adj[i][mid].ff>p)hi=mid-1;
   else
   {
    ans=adj[i][mid].ss;
    hi=mid-1;
   }
  }
  if(ans!=-1)return ans;
 }

 return -1;

}

ll query1(ll x,ll s)
{
 ll i;
 for(i=s;i>=1;i--)
 {
  ll p=x-up[i];
  ll lo=0,hi=adj[i].sz-1,mid,ans=-1;
  while(lo<=hi)
  {
   mid=(lo+hi)>>1;
   if(adj[i][mid].ff<p)lo=mid+1;
   else if(adj[i][mid].ff>p)hi=mid-1;
   else
   {
    ans=adj[i][mid].ss;
    lo=mid+1;
   }
  }
  if(ans!=-1)return ans;
 }

 return -1;
}

int main()
{
 ll n,i,j,q,x,l,r,v;

 while(cin>>n>>q)
 {
  ll a[n+5];

  f(i,1,n+1)
  {
   ent(a[i]);
  }
  ll s=sqrt(n);
  if(s*s<n)s++;
  ll k=n/s;
  if(n%s!=0)k++;

  for(i=1;i<=n;i++)
  {
   adj[(i/k)+(i%k!=0)].pb(mk(a[i],i));
  }

  for(i=1;i<=s;i++)
  {
   sort(adj[i].begin(),adj[i].end());
  }
  mem(up);

  while(q--)
  {
   ent(x);
   if(x==1)
   {
    ent3(l,r,v);
    ll sf=l/k+(l%k!=0);
    ll sl=r/k+(r%k!=0);
    if(sf==sl)
    {
     update3(sf,l,r,v);
     continue;
    }

    update1(sf,l,v);

    update2(sl,r,v);

    for(i=sf+1;i<sl;i++)up[i]+=v;
    continue;
   }

   ll y;
   ent(y);
   ll ans1=query(y,s);
   ll ans2=query1(y,s);
   if(ans1==-1)
   {
    pf("-1\n");
    continue;
   }
   pf("%lld\n",ans2-ans1);

  }

 }
}


/*
Nahid Hossain
Jahangirnagar University
Roll:54
*/
#include<bits/stdc++.h>
#define ll          long long int
#define db          double
#define pf          printf
#define sf          scanf
#define ff          first
#define ss          second
#define clr         clear()
#define sz          size()
#define pb          push_back
#define mk          make_pair
#define pi          acos(-1)
#define inf         123456789
#define mod         1000000007
#define ull         unsigned long long int
#define f(i,k,n)    for(ll i=k;i<n;i++)
#define fr(i,n,k)   for(i=n;i>=k;i--)
#define ent(a)      scanf("%lld",&a)
#define ent2(a,b)   scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a)      memset(a,0,sizeof(a))
#define vec(v,s)    vector<ll>v[s]
#define arr(a,s)    ll a[s];
//#define check(n,pos) (n&(1<<pos))
//#define set(n,pos)  (n|(1<<pos))
//knight and king//
int dr[]= {2, 2, -2, -2, 1, -1, 1, -1};
int dc[]= {1,-1,  1, -1, 2,  2,-2, -2};
int dr1[]= {0, 0, 0, 1, 1, 1, -1, -1, -1};
int dc1[]= {-1,0, 1,-1, 0, 1, -1, 0,   1};
int dr2[]= {0, 0, 1, -1};
int dc2[]= {1,-1, 0,  0};
////////////////////////////
using namespace std;

#define ma 710
#define ma1 10000000000000
vector<pair<ll,ll> >adj[ma];
ll up[ma];

ll update1(ll seg,ll x,ll val)
{
 ll i;
 for(i=0;i<adj[seg].sz;i++)
 {
  if(adj[seg][i].ss>=x)adj[seg][i].ff+=val;
 }
 sort(adj[seg].begin(),adj[seg].end());
}

ll update2(ll seg,ll x,ll val)
{
 ll i;
 for(i=0;i<adj[seg].sz;i++)
 {
  if(adj[seg][i].ss<=x)adj[seg][i].ff+=val;
 }
 sort(adj[seg].begin(),adj[seg].end());
}

ll update3(ll seg,ll f,ll l,ll v)
{
 ll i;
 for(i=0;i<adj[seg].sz;i++)
 {
  if(adj[seg][i].ss>=f&&adj[seg][i].ss<=l)adj[seg][i].ff+=v;
 }
 sort(adj[seg].begin(),adj[seg].end());
}

ll query(ll x,ll s)
{
 ll i;
 for(i=1;i<=s;i++)
 {
  ll p=x-up[i];
  ll lo=0,hi=adj[i].sz-1,mid,ans=-1;
  while(lo<=hi)
  {
   mid=(lo+hi)>>1;
   if(adj[i][mid].ff<p)lo=mid+1;
   else if(adj[i][mid].ff>p)hi=mid-1;
   else
   {
    ans=adj[i][mid].ss;
    hi=mid-1;
   }
  }
  if(ans!=-1)return ans;
 }

 return -1;

}

ll query1(ll x,ll s)
{
 ll i;
 for(i=s;i>=1;i--)
 {
  ll p=x-up[i];
  ll lo=0,hi=adj[i].sz-1,mid,ans=-1;
  while(lo<=hi)
  {
   mid=(lo+hi)>>1;
   if(adj[i][mid].ff<p)lo=mid+1;
   else if(adj[i][mid].ff>p)hi=mid-1;
   else
   {
    ans=adj[i][mid].ss;
    lo=mid+1;
   }
  }
  if(ans!=-1)return ans;
 }

 return -1;
}

int main()
{
 ll n,i,j,q,x,l,r,v;

 while(cin>>n>>q)
 {
  ll a[n+5];

  f(i,1,n+1)
  {
   ent(a[i]);
  }
  ll s=sqrt(n);
  if(s*s<n)s++;
  ll k=n/s;
  if(n%s!=0)k++;

  for(i=1;i<=n;i++)
  {
   adj[(i/k)+(i%k!=0)].pb(mk(a[i],i));
  }

  for(i=1;i<=s;i++)
  {
   sort(adj[i].begin(),adj[i].end());
  }
  mem(up);

  while(q--)
  {
   ent(x);
   if(x==1)
   {
    ent3(l,r,v);
    ll sf=l/k+(l%k!=0);
    ll sl=r/k+(r%k!=0);
    if(sf==sl)
    {
     update3(sf,l,r,v);
     continue;
    }

    update1(sf,l,v);

    update2(sl,r,v);

    for(i=sf+1;i<sl;i++)up[i]+=v;
    continue;
   }

   ll y;
   ent(y);
   ll ans1=query(y,s);
   ll ans2=query1(y,s);
   if(ans1==-1)
   {
    pf("-1\n");
    continue;
   }
   pf("%lld\n",ans2-ans1);

  }

 }
}


/*
Nahid Hossain
Jahangirnagar University
Roll:54
*/
#include<bits/stdc++.h>
#define ll          long long int
#define db          double
#define pf          printf
#define sf          scanf
#define ff          first
#define ss          second
#define clr         clear()
#define sz          size()
#define pb          push_back
#define mk          make_pair
#define pi          acos(-1)
#define inf         123456789
#define mod         1000000007
#define ull         unsigned long long int
#define f(i,k,n)    for(ll i=k;i<n;i++)
#define fr(i,n,k)   for(i=n;i>=k;i--)
#define ent(a)      scanf("%lld",&a)
#define ent2(a,b)   scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a)      memset(a,0,sizeof(a))
#define vec(v,s)    vector<ll>v[s]
#define arr(a,s)    ll a[s];
//#define check(n,pos) (n&(1<<pos))
//#define set(n,pos)  (n|(1<<pos))
//knight and king//
int dr[]= {2, 2, -2, -2, 1, -1, 1, -1};
int dc[]= {1,-1,  1, -1, 2,  2,-2, -2};
int dr1[]= {0, 0, 0, 1, 1, 1, -1, -1, -1};
int dc1[]= {-1,0, 1,-1, 0, 1, -1, 0,   1};
int dr2[]= {0, 0, 1, -1};
int dc2[]= {1,-1, 0,  0};
////////////////////////////
using namespace std;

#define ma 710
#define ma1 10000000000000
vector<pair<ll,ll> >adj[ma];
ll up[ma];

ll update1(ll seg,ll x,ll val)
{
 ll i;
 for(i=0;i<adj[seg].sz;i++)
 {
  if(adj[seg][i].ss>=x)adj[seg][i].ff+=val;
 }
 sort(adj[seg].begin(),adj[seg].end());
}

ll update2(ll seg,ll x,ll val)
{
 ll i;
 for(i=0;i<adj[seg].sz;i++)
 {
  if(adj[seg][i].ss<=x)adj[seg][i].ff+=val;
 }
 sort(adj[seg].begin(),adj[seg].end());
}

ll update3(ll seg,ll f,ll l,ll v)
{
 ll i;
 for(i=0;i<adj[seg].sz;i++)
 {
  if(adj[seg][i].ss>=f&&adj[seg][i].ss<=l)adj[seg][i].ff+=v;
 }
}

ll query(ll x,ll s)
{
 ll i;
 for(i=1;i<=s;i++)
 {
  ll p=x-up[i];
  ll lo=0,hi=adj[i].sz-1,mid,ans=-1;
  while(lo<=hi)
  {
   mid=(lo+hi)>>1;
   if(adj[i][mid].ff<p)lo=mid+1;
   else if(adj[i][mid].ff>p)hi=mid-1;
   else
   {
    ans=adj[i][mid].ss;
    hi=mid-1;
   }
  }
  if(ans!=-1)return ans;
 }

 return -1;

}

ll query1(ll x,ll s)
{
 ll i;
 for(i=s;i>=1;i--)
 {
  ll p=x-up[i];
  ll lo=0,hi=adj[i].sz-1,mid,ans=-1;
  while(lo<=hi)
  {
   mid=(lo+hi)>>1;
   if(adj[i][mid].ff<p)lo=mid+1;
   else if(adj[i][mid].ff>p)hi=mid-1;
   else
   {
    ans=adj[i][mid].ss;
    lo=mid+1;
   }
  }
  if(ans!=-1)return ans;
 }

 return -1;
}

int main()
{
 ll n,i,j,q,x,l,r,v;

 while(cin>>n>>q)
 {
  ll a[n+5];

  f(i,1,n+1)
  {
   ent(a[i]);
  }
  ll s=sqrt(n);
  if(s*s<n)s++;
  ll k=n/s;
  if(n%s!=0)k++;

  for(i=1;i<=n;i++)
  {
   adj[(i/k)+(i%k!=0)].pb(mk(a[i],i));
   sort(adj[i].begin(),adj[i].end());
  }

  /*for(i=1;i<=s;i++)
  {
   cout<<adj[i].sz<<endl;
   for(j=0;j<adj[i].sz;j++)cout<<adj[i][j].ff<<"  ";
   cout<<endl;
  }*/
  mem(up);

  while(q--)
  {
   ent(x);
   if(x==1)
   {
    ent3(l,r,v);
    ll sf=l/k+(l%k!=0);
    ll sl=r/k+(r%k!=0);
    if(sf==sl)
    {
     update3(sf,l,r,v);
     continue;
    }

    update1(sf,l,v);

    update2(sl,r,v);

    for(i=sf+1;i<sl;i++)up[i]+=v;
    continue;
   }

   ll y;
   ent(y);
   ll ans1=query(y,s);
   ll ans2=query1(y,s);
   if(ans1==-1)
   {
    pf("-1\n");
    continue;
   }
   pf("%lld\n",ans2-ans1);

  }

 }
}


/*
Nahid Hossain
Jahangirnagar University
Roll:54
*/
#include<bits/stdc++.h>
#define ll          long long int
#define db          double
#define pf          printf
#define sf          scanf
#define ff          first
#define ss          second
#define clr         clear()
#define sz          size()
#define pb          push_back
#define mk          make_pair
#define pi          acos(-1)
#define inf         123456789
#define mod         1000000007
#define ull         unsigned long long int
#define f(i,k,n)    for(ll i=k;i<n;i++)
#define fr(i,n,k)   for(i=n;i>=k;i--)
#define ent(a)      scanf("%lld",&a)
#define ent2(a,b)   scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a)      memset(a,0,sizeof(a))
#define vec(v,s)    vector<ll>v[s]
#define arr(a,s)    ll a[s];
//#define check(n,pos) (n&(1<<pos))
//#define set(n,pos)  (n|(1<<pos))
//knight and king//
int dr[]= {2, 2, -2, -2, 1, -1, 1, -1};
int dc[]= {1,-1,  1, -1, 2,  2,-2, -2};
int dr1[]= {0, 0, 0, 1, 1, 1, -1, -1, -1};
int dc1[]= {-1,0, 1,-1, 0, 1, -1, 0,   1};
int dr2[]= {0, 0, 1, -1};
int dc2[]= {1,-1, 0,  0};
////////////////////////////
using namespace std;

#define ma 710
#define ma1 10000000000000
vector<pair<ll,ll> >adj[ma];
ll up[ma];

ll update1(ll seg,ll x,ll val)
{
 ll i;
 for(i=0;i<adj[seg].sz;i++)
 {
  if(adj[seg][i].ss>=x)adj[seg][i].ff+=val;
 }
 sort(adj[seg].begin(),adj[seg].end());
}

ll update2(ll seg,ll x,ll val)
{
 ll i;
 for(i=0;i<adj[seg].sz;i++)
 {
  if(adj[seg][i].ss<=x)adj[seg][i].ff+=val;
 }
 sort(adj[seg].begin(),adj[seg].end());
}

ll update3(ll seg,ll f,ll l,ll v)
{
 ll i;
 for(i=0;i<adj[seg].sz;i++)
 {
  if(adj[seg][i].ss>=f&&adj[seg][i].ss<=l)adj[seg][i].ff+=v;
 }
}

ll query(ll x,ll s)
{
 ll i;
 for(i=1;i<=s;i++)
 {
  ll p=x-up[i];
  ll lo=0,hi=adj[i].sz-1,mid,ans=-1;
  while(lo<=hi)
  {
   mid=(lo+hi)>>1;
   if(adj[i][mid].ff<p)lo=mid+1;
   else if(adj[i][mid].ff>p)hi=mid-1;
   else
   {
    ans=adj[i][mid].ss;
    hi=mid-1;
   }
  }
  if(ans!=-1)return ans;
 }

 return -1;

}

ll query1(ll x,ll s)
{
 ll i;
 for(i=s;i>=1;i--)
 {
  ll p=x-up[i];
  ll lo=0,hi=adj[i].sz-1,mid,ans=-1;
  while(lo<=hi)
  {
   mid=(lo+hi)>>1;
   if(adj[i][mid].ff<p)lo=mid+1;
   else if(adj[i][mid].ff>p)hi=mid-1;
   else
   {
    ans=adj[i][mid].ss;
    lo=mid+1;
   }
  }
  if(ans!=-1)return ans;
 }

 return -1;
}

int main()
{
 ll n,i,j,q,x,l,r,v;

 while(cin>>n>>q)
 {
  ll a[n+5];

  f(i,1,n+1)
  {
   ent(a[i]);
  }
  ll s=sqrt(n);
  if(s*s<n)s++;
  ll k=n/s;
  if(n%s!=0)k++;

  for(i=1;i<=n;i++)
  {
   adj[(i/k)+(i%k!=0)].pb(mk(a[i],i));
  }

  /*for(i=1;i<=s;i++)
  {
   cout<<adj[i].sz<<endl;
   for(j=0;j<adj[i].sz;j++)cout<<adj[i][j].ff<<"  ";
   cout<<endl;
  }*/
  mem(up);

  while(q--)
  {
   ent(x);
   if(x==1)
   {
    ent3(l,r,v);
    ll sf=l/k+(l%k!=0);
    ll sl=r/k+(r%k!=0);
    if(sf==sl)
    {
     update3(sf,l,r,v);
     continue;
    }

    update1(sf,l,v);

    update2(sl,r,v);

    for(i=sf+1;i<sl;i++)up[i]+=v;
    continue;
   }

   ll y;
   ent(y);
   ll ans1=query(y,s);
   ll ans2=query1(y,s);
   if(ans1==-1)
   {
    pf("-1\n");
    continue;
   }
   pf("%lld\n",ans2-ans1);

  }

 }
}


#include <bits/stdc++.h>
#define long long long
#define pb push_back
using namespace std;
long cmp(pair <long , long > a ,pair < long ,long > b)
{
    if(a.first!=b.first) return a.first<b.first;
    else return a.second<b.second;
}
long n,q,a[500005],i,s,m,x,y,z,l,r,mx,mn;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>q;
    pair < long , long >p;
    for(i=0;i<n;++i)
    cin>>a[i];
    s=sqrt(n);
    vector < pair < long , long > > v[n/s+1];
    long inc[n/s+1]={0};
    for(i=0;i<n;++i)
    v[i/s].pb({a[i],i});
    m=(n-1)/s+1;
    for(i=0;i<m;++i)
    sort(v[i].begin(),v[i].end(),cmp);
    while(q--)
    {
        cin>>x;
        if(x==1)
        {
            cin>>x>>y>>z;
            x--;y--;
            for(i=x/s+1;i<y/s;++i)
            inc[i]+=z;
            r=min((x/s+1)*s,y+1);
            l=x;
            for(i=0;i<v[x/s].size();++i)
            if(v[x/s][i].second>=l && v[x/s][i].second<r)
            v[x/s][i].first+=z;
            sort(v[x/s].begin(),v[x/s].end(),cmp);
            if(y/s==x/s) continue;
            l=(y/s)*s;
            r=y+1;
            for(i=0;i<v[y/s].size();++i)
            if(v[y/s][i].second>=l && v[y/s][i].second<r)
            v[y/s][i].first+=z;
            sort(v[y/s].begin(),v[y/s].end(),cmp);
        }
        else  if(x==2)
        {
            cin>>y;
            mx=-1;
            mn=1e9;
            for(i=0;i<m;++i)
            {
                p={y-inc[i],(long)-1};
                l=upper_bound(v[i].begin(),v[i].end(),p)-v[i].begin();
                p={y-inc[i],(long)1e9};
                r=upper_bound(v[i].begin(),v[i].end(),p)-v[i].begin();
                if(r==0) continue;
                if(v[i][r-1].first!=y-inc[i]) continue;
                mx=max(v[i][r-1].second,mx);
                mn=min(v[i][l].second,mn);
            }
            if(mn==1e9) mn=0;
            cout<<mx-mn<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define long long long
#define pb push_back
using namespace std;
long cmp(pair <long , long > a ,pair < long ,long > b)
{
    if(a.first!=b.first) return a.first<b.first;
    else return a.second<b.second;
}
long n,q,a[500005],i,s,m,x,y,z,l,r,mx,mn;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>q;
    pair < long , long >p;
    for(i=0;i<n;++i)
    cin>>a[i];
    s=sqrt(n);
    vector < pair < long , long > > v[n/s+1];
    long inc[n/s+1]={0};
    for(i=0;i<n;++i)
    v[i/s].pb({a[i],i});
    m=(n-1)/s+1;
    for(i=0;i<m;++i)
    sort(v[i].begin(),v[i].end(),cmp);
    while(q--)
    {
        cin>>x;
        if(x==1)
        {
            cin>>x>>y>>z;
            x--;y--;
            for(i=x/s+1;i<y/s;++i)
            inc[i]+=z;
            r=min((x/s+1)*s,y+1);
            l=x;
            for(i=0;i<v[x/s].size();++i)
            if(v[x/s][i].second>=l && v[x/s][i].second<r)
            v[x/s][i].first+=z;
            sort(v[x/s].begin(),v[x/s].end(),cmp);
            if(y/s==x/s) continue;
            l=(y/s)*s;
            r=y+1;
            for(i=0;i<v[y/s].size();++i)
            if(v[y/s][i].second>=l && v[y/s][i].second<r)
            v[y/s][i].first+=z;
            sort(v[y/s].begin(),v[y/s].end(),cmp);
        }
        else if(x==2)
        {
            cin>>y;
            mx=-1;
            mn=1e9;
            for(i=0;i<m;++i)
            {
                p={y-inc[i],(long)-1};
                l=upper_bound(v[i].begin(),v[i].end(),p)-v[i].begin();
                p={y-inc[i],(long)1e9};
                r=upper_bound(v[i].begin(),v[i].end(),p)-v[i].begin();
                if(r==0) continue;
                if(v[i][r-1].first!=y-inc[i]) continue;
                mx=max(v[i][r-1].second,mx);
                mn=min(v[i][l].second,mn);
            }
            if(mn==1e9) mn=0;
            cout<<mx-mn<<endl;
        }
    }
    return 0;
}


#include<cstdio>
#include<vector>
#include<set>

using namespace std;

#define ll long long

struct Rat {
    ll p, q;
    Rat() {}
    Rat(ll x, ll y) {
        p = x, q = y;
    }
    bool operator == (const Rat &a) const {
        return p * a.q == a.p * q;
    }
    bool operator < (const Rat &a) const {
    	return p * a.q < a.p * q;
    }
};

Rat rat[100005];
vector<int> adj[100005];
int no[100005];
int out[100005];
int n,m,k;

set< pair<Rat,int> > st;

bool ck(double mid) {
	st.clear();
	for(int i=0;i<n;++i) if(!no[i]) {
		int tot = adj[i].size(), cnt = 0;
		for(int j=0;j<adj[i].size();++j) {
			int v = adj[i][j];
			if(!no[v]) cnt++;
		}
		st.insert( make_pair( Rat(cnt, tot), i) );
		rat[i] = Rat(cnt, tot), out[i] = 0;
	}

	while(st.size() && st.begin()->first.p < mid * st.begin()->first.q) {
		int u = st.begin()->second;
		out[u] = 1;
		st.erase(st.begin());
		for(int i=0;i<adj[u].size();++i) {
			int v = adj[u][i];
			if(no[v] || out[v]) continue;
			if(st.count(make_pair(rat[v],v))) {
				st.erase(make_pair(rat[v],v));
				rat[v].p--;
				st.insert(make_pair(rat[v],v));
			}
		}
	}

	if(st.size()) return true;
	return false;
}

int main() {
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<k;++i) {
		int u; scanf("%d",&u), u--;
		no[u] = 1;
	}
	for(int i=0;i<m;++i) {
		int u,v; scanf("%d%d",&u,&v), u--, v--;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	double s = 0, e = 1, ans = s;
	for(int z=0;z<60;++z) {
		double mid = (s + e) / 2;
		if(ck(mid)) {
			s = mid, ans = mid;
		} else {
			e = mid;
		}
	} ck(ans);
	printf("%d\n",(int)st.size());
	for(auto it=st.begin();it!=st.end();++it) {
		printf("%d ",it->second+1);
	}
}


#include<cstdio>
#include<vector>
#include<set>

using namespace std;

#define ll long long

struct Rat {
    ll p, q;
    Rat() {}
    Rat(ll x, ll y) {
        p = x, q = y;
    }
    bool operator == (const Rat &a) const {
        return p * a.q == a.p * q;
    }
    bool operator < (const Rat &a) const {
    	return p * a.q < a.p * q;
    }
};

Rat rat[100005];
vector<int> adj[100005];
int no[100005];
int out[100005];
int n,m,k;

set< pair<Rat,int> > st;

bool ck(double mid) {
	st.clear();
	for(int i=0;i<n;++i) if(!no[i]) {
		int tot = adj[i].size(), cnt = 0;
		for(int j=0;j<adj[i].size();++j) {
			int v = adj[i][j];
			if(!no[v]) cnt++;
		}
		st.insert( make_pair( Rat(cnt, tot), i) );
		rat[i] = Rat(cnt, tot), out[i] = 0;
	}

	while(st.size() && st.begin()->first.p < mid * st.begin()->first.q) {
		int u = st.begin()->second;
		out[u] = 1;
		st.erase(st.begin());
		for(int i=0;i<adj[u].size();++i) {
			int v = adj[u][i];
			if(no[v] || out[v]) continue;
			if(st.count(make_pair(rat[v],v))) {
				st.erase(make_pair(rat[v],v));
				rat[v].p--;
				st.insert(make_pair(rat[v],v));
			}
		}
	}

	if(st.size()) return true;
	return false;
}

int main() {
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<k;++i) {
		int u; scanf("%d",&u), u--;
		no[u] = 1;
	}
	for(int i=0;i<m;++i) {
		int u,v; scanf("%d%d",&u,&v), u--, v--;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	double s = 0, e = 1, ans = s;
	for(int z=0;z<20;++z) {
		double mid = (s + e) / 2;
		if(ck(mid)) {
			s = mid, ans = mid;
		} else {
			e = mid;
		}
	} ck(ans);
	printf("%d\n",(int)st.size());
	for(auto it=st.begin();it!=st.end();++it) {
		printf("%d ",it->second+1);
	}
}


#include<cstdio>
#include<vector>
#include<set>

using namespace std;

#define ll long long

struct Rat {
    ll p, q;
    Rat() {}
    Rat(ll x, ll y) {
        p = x, q = y;
    }
    bool operator == (const Rat &a) const {
        return p * a.q == a.p * q;
    }
    bool operator < (const Rat &a) const {
    	return p * a.q < a.p * q;
    }
};

Rat rat[100005];
vector<int> adj[100005];
int no[100005];
int out[100005];
int n,m,k;

set< pair<Rat,int> > st;

bool ck(double mid) {
	st.clear();
	for(int i=0;i<n;++i) if(!no[i]) {
		int tot = adj[i].size(), cnt = 0;
		for(int j=0;j<adj[i].size();++j) {
			int v = adj[i][j];
			if(!no[v]) cnt++;
		}
		st.insert( make_pair( Rat(cnt, tot), i) );
		rat[i] = Rat(cnt, tot), out[i] = 0;
	}

	while(st.size() && st.begin()->first.p < mid * st.begin()->first.q) {
		int u = st.begin()->second;
		out[u] = 1;
		st.erase(st.begin());
		for(int i=0;i<adj[u].size();++i) {
			int v = adj[u][i];
			if(no[v] || out[v]) continue;
			{
				st.erase(make_pair(rat[v],v));
				rat[v].p--;
				st.insert(make_pair(rat[v],v));
			}
		}
	}

	if(st.size()) return true;
	return false;
}

int main() {
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<k;++i) {
		int u; scanf("%d",&u), u--;
		no[u] = 1;
	}
	for(int i=0;i<m;++i) {
		int u,v; scanf("%d%d",&u,&v), u--, v--;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	double s = 0, e = 1, ans = s;
	for(int z=0;z<30;++z) {
		double mid = (s + e) / 2;
		if(ck(mid)) {
			s = mid, ans = mid;
		} else {
			e = mid;
		}
	} ck(ans);
	printf("%d\n",(int)st.size());
	for(auto it=st.begin();it!=st.end();++it) {
		printf("%d ",it->second+1);
	}
}


#include <bits/stdc++.h>

using namespace std;

int N, M, K;
vector<int> adj[100001];
int gooddeg[100001];
int realdeg[100001];
bool bad[100001];
bool bad2[100001];
int target[100001];
bool seen[100001];
vector<int> group, ans;
bool ingroup[100001];
bool inQ[100001];

bool good(int u)
{
    return !bad[u] && !bad2[u];
}

void dfs(int u)
{
    group.push_back(u);
    seen[u]=true;
    for(auto& v: adj[u]) if(!seen[v] && good(v))
        dfs(v);
}

bool check(double x)
{
    queue<int> Q;
    for(int i=1; i<=N; i++) if(!bad[i])
    {
        target[i]=ceil(x*adj[i].size());
        realdeg[i]=gooddeg[i];
        seen[i]=false;
        if(realdeg[i]<target[i])
            Q.push(i), inQ[i]=true;
        else
            inQ[i]=false;
    }
    while(!Q.empty())
    {
        int u=Q.front();
        Q.pop();
        bad2[u]=true;
        for(auto& v: adj[u]) if(!bad[v])
        {
            realdeg[v]--;
            if(realdeg[v]<target[v] && !inQ[v])
                Q.push(v), inQ[v]=true;
        }
    }
    for(int i=1; i<=N; i++) if(!seen[i] && good(i))
    {
        group.clear();
        dfs(i);
        for(auto& u: group)
            ingroup[u]=true;
        bool ok=true;
        for(auto& u: group)
        {
            int cnt=0;
            for(auto& v: adj[u])
                cnt+=ingroup[v];
            if(cnt<target[u])
            {
                ok=false;
                break;
            }
        }
        for(auto& u: group)
            ingroup[u]=false;
        if(ok)
        {
            ans.swap(group);
            return true;
        }
    }
    return false;
}

int main()
{
    scanf("%d%d%d", &N, &M, &K);
    int a, b;
    for(int i=0; i<K; i++)
    {
        scanf("%d", &a);
        bad[a]=true;
    }
    for(int i=0; i<M; i++)
    {
        scanf("%d%d", &a, &b);
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    for(int u=1; u<=N; u++)
        for(auto& v: adj[u])
            if(!bad[v])
                gooddeg[u]++;
    double lo=0.0, mid, hi=1.0;
    for(int i=0; i<60; i++)
    {
        mid=(lo+hi)/2.0;
        if(check(mid))
            lo=mid;
        else
            hi=mid;
    }
    if(ans.empty())
    {
        printf("1\n");
        for(int i=1; i<=N; i++) if(!bad[i])
            return printf("%d\n", i), 0;
    }
    else
    {
        printf("%d\n", ans.size());
        for(auto& it: ans)
            printf("%d ", it);
        printf("\n");
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int N, M, K;
vector<int> adj[100001];
int gooddeg[100001];
int realdeg[100001];
bool bad[100001];
bool bad2[100001];
int target[100001];
bool seen[100001];
vector<int> group, ans;
bool ingroup[100001];
bool inQ[100001];

bool good(int u)
{
    return !bad[u] && !bad2[u];
}

void dfs(int u)
{
    group.push_back(u);
    seen[u]=true;
    for(auto& v: adj[u]) if(!seen[v] && good(v))
        dfs(v);
}

bool check(double x)
{
    queue<int> Q;
    for(int i=1; i<=N; i++) if(!bad[i])
    {
        target[i]=ceil(x*adj[i].size());
        realdeg[i]=gooddeg[i];
        seen[i]=false;
        if(realdeg[i]<target[i])
            Q.push(i), inQ[i]=true;
        else
            inQ[i]=false;
    }
    while(!Q.empty())
    {
        int u=Q.front();
        Q.pop();
        bad2[u]=true;
        for(auto& v: adj[u])
        {
            realdeg[v]--;
            if(realdeg[v]<target[v] && !inQ[v])
                Q.push(v), inQ[v]=true;
        }
    }
    for(int i=1; i<=N; i++) if(!seen[i] && good(i))
    {
        group.clear();
        dfs(i);
        for(auto& u: group)
            ingroup[u]=true;
        bool ok=true;
        for(auto& u: group)
        {
            int cnt=0;
            for(auto& v: adj[u])
                cnt+=ingroup[v];
            if(cnt<target[u])
            {
                ok=false;
                break;
            }
        }
        for(auto& u: group)
            ingroup[u]=false;
        if(ok)
        {
            ans.swap(group);
            return true;
        }
    }
    return false;
}

int main()
{
    scanf("%d%d%d", &N, &M, &K);
    int a, b;
    for(int i=0; i<K; i++)
    {
        scanf("%d", &a);
        bad[a]=true;
    }
    for(int i=0; i<M; i++)
    {
        scanf("%d%d", &a, &b);
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    for(int u=1; u<=N; u++)
        for(auto& v: adj[u])
            if(!bad[v])
                gooddeg[u]++;
    double lo=0.0, mid, hi=1.0;
    for(int i=0; i<60; i++)
    {
        mid=(lo+hi)/2.0;
        if(check(mid))
            lo=mid;
        else
            hi=mid;
    }
    printf("%d\n", ans.size());
    for(auto& it: ans)
        printf("%d ", it);
    printf("\n");
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int N, M, K;
vector<int> adj[100001];
int gooddeg[100001];
bool bad[100001];
bool bad2[100001];
int target[100001];
bool seen[100001];
vector<int> group, ans;
bool ingroup[100001];

bool good(int u)
{
    return !bad[u] && !bad2[u];
}

void dfs(int u)
{
    group.push_back(u);
    seen[u]=true;
    for(auto& v: adj[u]) if(!seen[v] && good(v))
        dfs(v);
}

bool check(double x)
{
    for(int i=1; i<=N; i++) if(!bad[i])
    {
        target[i]=ceil(x*adj[i].size());
        bad2[i]=gooddeg[i]<target[i];
        seen[i]=false;
    }
    for(int i=1; i<=N; i++) if(!seen[i] && good(i))
    {
        group.clear();
        dfs(i);
        for(auto& u: group)
            ingroup[u]=true;
        bool ok=true;
        for(auto& u: group)
        {
            int cnt=0;
            for(auto& v: adj[u])
                cnt+=ingroup[v];
            if(cnt<target[u])
            {
                ok=false;
                break;
            }
        }
        for(auto& u: group)
            ingroup[u]=false;
        if(ok)
        {
            ans.swap(group);
            return true;
        }
    }
    return false;
}

int main()
{
    scanf("%d%d%d", &N, &M, &K);
    int a, b;
    for(int i=0; i<K; i++)
    {
        scanf("%d", &a);
        bad[a]=true;
    }
    for(int i=0; i<M; i++)
    {
        scanf("%d%d", &a, &b);
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    for(int u=1; u<=N; u++)
        for(auto& v: adj[u])
            if(!bad[v])
                gooddeg[u]++;
    double lo=0.0, mid, hi=1.0;
    for(int i=0; i<60; i++)
    {
        mid=(lo+hi)/2.0;
        if(check(mid))
            lo=mid;
        else
            hi=mid;
    }
    printf("%d\n", ans.size());
    for(auto& it: ans)
        printf("%d ", it);
    printf("\n");
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int N, M, K;
vector<int> adj[100001];
int gooddeg[100001];
int realdeg[100001];
bool bad[100001];
bool bad2[100001];
int target[100001];
bool seen[100001];
vector<int> group, ans;
bool ingroup[100001];
bool inQ[100001];

bool good(int u)
{
    return !bad[u] && !bad2[u];
}

void dfs(int u)
{
    group.push_back(u);
    seen[u]=true;
    for(auto& v: adj[u]) if(!seen[v] && good(v))
        dfs(v);
}

bool check(double x)
{
    queue<int> Q;
    for(int i=1; i<=N; i++) if(!bad[i])
    {
        target[i]=ceil(x*adj[i].size());
        realdeg[i]=gooddeg[i];
        seen[i]=false;
        if(realdeg[i]<target[i])
            Q.push(i), inQ[i]=true;
        else
            inQ[i]=false;
    }
    while(!Q.empty())
    {
        int u=Q.front();
        Q.pop();
        bad2[u]=true;
        for(auto& v: adj[u])
        {
            realdeg[v]--;
            if(realdeg[v]<target[v] && !inQ[v])
                Q.push(v), inQ[v]=true;
        }
    }
    for(int i=1; i<=N; i++) if(!seen[i] && good(i))
    {
        group.clear();
        dfs(i);
        for(auto& u: group)
            ingroup[u]=true;
        bool ok=true;
        for(auto& u: group)
        {
            int cnt=0;
            for(auto& v: adj[u])
                cnt+=ingroup[v];
            if(cnt<target[u])
            {
                ok=false;
                break;
            }
        }
        for(auto& u: group)
            ingroup[u]=false;
        if(ok)
        {
            ans.swap(group);
            return true;
        }
    }
    return false;
}

int main()
{
    scanf("%d%d%d", &N, &M, &K);
    int a, b;
    for(int i=0; i<K; i++)
    {
        scanf("%d", &a);
        bad[a]=true;
    }
    for(int i=0; i<M; i++)
    {
        scanf("%d%d", &a, &b);
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    for(int u=1; u<=N; u++)
        for(auto& v: adj[u])
            if(!bad[v])
                gooddeg[u]++;
    double lo=0.0, mid, hi=1.0;
    for(int i=0; i<60; i++)
    {
        mid=(lo+hi)/2.0;
        if(check(mid))
            lo=mid;
        else
            hi=mid;
    }
    if(ans.empty())
    {
        printf("1\n");
        for(int i=1; i<=N; i++) if(!bad[i])
            return printf("%d\n", i), 0;
    }
    else
    {
        printf("%d\n", ans.size());
        for(auto& it: ans)
            printf("%d ", it);
        printf("\n");
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int N, M, K;
vector<int> adj[100001];
int gooddeg[100001];
int realdeg[100001];
bool bad[100001];
bool bad2[100001];
int target[100001];
bool seen[100001];
vector<int> group, ans;
bool ingroup[100001];
bool inQ[100001];

bool good(int u)
{
    return !bad[u] && !bad2[u];
}

void dfs(int u)
{
    group.push_back(u);
    seen[u]=true;
    for(auto& v: adj[u]) if(!seen[v] && good(v))
        dfs(v);
}

bool check(double x)
{
    queue<int> Q;
    for(int i=1; i<=N; i++) if(!bad[i])
    {
        target[i]=ceil(x*adj[i].size());
        realdeg[i]=gooddeg[i];
        seen[i]=false;
        if(realdeg[i]<target[i])
            Q.push(i), inQ[i]=true;
        else
            inQ[i]=false;
        bad2[i]=false;
    }
    while(!Q.empty())
    {
        int u=Q.front();
        Q.pop();
        bad2[u]=true;
        for(auto& v: adj[u]) if(!bad[v])
        {
            realdeg[v]--;
            if(realdeg[v]<target[v] && !inQ[v])
                Q.push(v), inQ[v]=true;
        }
    }
    for(int i=1; i<=N; i++) if(!seen[i] && good(i))
    {
        group.clear();
        dfs(i);
        for(auto& u: group)
            ingroup[u]=true;
        bool ok=true;
        for(auto& u: group)
        {
            int cnt=0;
            for(auto& v: adj[u])
                cnt+=ingroup[v];
            if(cnt<target[u])
            {
                ok=false;
                break;
            }
        }
        for(auto& u: group)
            ingroup[u]=false;
        if(ok)
        {
            ans.swap(group);
            return true;
        }
    }
    return false;
}

int main()
{
    scanf("%d%d%d", &N, &M, &K);
    int a, b;
    for(int i=0; i<K; i++)
    {
        scanf("%d", &a);
        bad[a]=true;
    }
    for(int i=0; i<M; i++)
    {
        scanf("%d%d", &a, &b);
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    for(int u=1; u<=N; u++)
        for(auto& v: adj[u])
            if(!bad[v])
                gooddeg[u]++;
    double lo=0.0, mid, hi=1.0;
    for(int i=0; i<60; i++)
    {
        mid=(lo+hi)/2.0;
        if(check(mid))
            lo=mid;
        else
            hi=mid;
    }
    if(ans.empty())
    {
        printf("1\n");
        for(int i=1; i<=N; i++) if(!bad[i])
            return printf("%d\n", i), 0;
    }
    else
    {
        printf("%d\n", ans.size());
        for(auto& it: ans)
            printf("%d ", it);
        printf("\n");
    }
    return 0;
}


#include <bits/stdc++.h>
//
using namespace std;

#define rep(i, a, b)    for (int i(a); i <= (b); ++i)
#define dec(i, a, b)    for (int i(a); i >= (b); --i)

typedef long long LL;

const double eps = 1e-8;

const int N = 100010;
int n, m, k;
vector <int> v[N];
int deg[N], irr[N], b[N], c[N], g[N], inn[N], ans[N];
int cnt = 0;

bool check(double x){

    int num = cnt;
    queue <int> Q;
    rep(i, 1, cnt) g[c[i]] = 1;
    rep(i, 1, cnt) inn[c[i]] = deg[c[i]] - irr[c[i]];
    rep(i, 1, cnt){
        if ((double)(inn[c[i]]) / (double)deg[c[i]] < x){
            Q.push(c[i]);
            g[c[i]] = 0;
            --num;
        }
    }

    while (!Q.empty()){
        int now = Q.front(); Q.pop();
        for (auto u : v[now]) if (g[u]){
            --inn[u];
            if ((double)inn[u] / (double)deg[u] < x){
                Q.push(u);
                g[u] = 0;
                --num;
            }
        }
    }

    if (num){
        int et = 0;
        rep(i, 1, cnt) if (g[c[i]]) ans[++et] = c[i];
        ans[0] = num;
        return true;
    }

    else return false;
}

int main(){

    scanf("%d%d%d", &n, &m, &k);
    rep(i, 1, k){
        int x;
        scanf("%d", &x);
        b[x] = 1;
    }

    rep(i, 1, m){
        int x, y;
        scanf("%d%d", &x, &y);
        v[x].push_back(y);
        v[y].push_back(x);
        ++deg[x], ++deg[y];
        if (b[x]) ++irr[y];
        if (b[y]) ++irr[x];
    }

    double l = 0.00, r = 1.00;

    cnt = 0;
    rep(i, 1, n) if (!b[i]) c[++cnt] = i;

    rep(i, 1, 100){
        double mid = (l + r) / 2;
        if (check(mid)) l = mid;
        else r = mid - eps;
    }

    printf("%d\n", ans[0]);
    rep(i, 1, ans[0]) printf("%d ", ans[i]);
    putchar(10);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b)    for (int i(a); i <= (b); ++i)
#define dec(i, a, b)    for (int i(a); i >= (b); --i)

typedef long long LL;

const double eps = 1e-8;

const int N = 100010;
int n, m, k;
vector <int> v[N];
int deg[N], irr[N], b[N], c[N], g[N], inn[N], ans[N];
int cnt = 0;

bool check(double x){

    int num = cnt;
    queue <int> Q;
    rep(i, 1, cnt) g[c[i]] = 1;
    rep(i, 1, cnt) inn[c[i]] = deg[c[i]] - irr[c[i]];
    rep(i, 1, cnt){
        if ((double)(inn[c[i]]) / (double)deg[c[i]] < x){
            Q.push(c[i]);
            g[c[i]] = 0;
            --num;
        }
    }

    while (!Q.empty()){
        int now = Q.front(); Q.pop();
        for (auto u : v[now]) if (g[u]){
            --inn[u];
            if ((double)inn[u] / (double)deg[u] < x){
                Q.push(u);
                g[u] = 0;
                --num;
            }
        }
    }

    if (num){
        int et = 0;
        rep(i, 1, cnt) if (g[c[i]]) ans[++et] = c[i];
        ans[0] = num;
        return true;
    }

    else return false;
}

int main(){

    scanf("%d%d%d", &n, &m, &k);
    rep(i, 1, k){
        int x;
        scanf("%d", &x);
        b[x] = 1;
    }

    rep(i, 1, m){
        int x, y;
        scanf("%d%d", &x, &y);
        v[x].push_back(y);
        v[y].push_back(x);
        ++deg[x], ++deg[y];
        if (b[x]) ++irr[y];
        if (b[y]) ++irr[x];
    }

    double l = 0.00, r = 1.00;

    cnt = 0;
    rep(i, 1, n) if (!b[i]) c[++cnt] = i;

    rep(i, 1, 100){
        double mid = (l + r) / 2;
        if (check(mid)) l = mid;
        else r = mid - eps;
    }

    printf("%d\n", ans[0]);
    rep(i, 1, ans[0]) printf("%d ", ans[i]);
    putchar(10);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b)    for (int i(a); i <= (b); ++i)
#define dec(i, a, b)    for (int i(a); i >= (b); --i)

typedef long long LL;

const double eps = 1e-8;

const int N = 100010;
int n, m, k;
vector <int> v[N];
int deg[N], irr[N], b[N], c[N], g[N], inn[N], ans[N];
int cnt = 0;

bool check(double x){

    int num = cnt;
    queue <int> Q;
    rep(i, 1, cnt) g[c[i]] = 1;
    rep(i, 1, cnt) inn[c[i]] = deg[c[i]] - irr[c[i]];
    rep(i, 1, cnt){
        if ((double)(inn[c[i]]) / (double)deg[c[i]] < x){
            Q.push(c[i]);
            g[c[i]] = 0;
            --num;
        }
    }

    while (!Q.empty()){
        int now = Q.front(); Q.pop();
        for (auto u : v[now]) if (g[u]){
            --inn[u];
            if ((double)inn[u] / (double)deg[u] < x){
                Q.push(u);
                g[u] = 0;
                --num;
            }
        }
    }

    if (num){
        int et = 0;
        rep(i, 1, cnt) if (g[c[i]]) ans[++et] = c[i];
        ans[0] = num;
        return true;
    }

    else return false;
}

int main(){

    scanf("%d%d%d", &n, &m, &k);
    rep(i, 1, k){
        int ;
        scanf("%d", &x);
        b[x] = 1;
    }

    rep(i, 1, m){
        int x, y;
        scanf("%d%d", &x, &y);
        v[x].push_back(y);
        v[y].push_back(x);
        ++deg[x], ++deg[y];
        if (b[x]) ++irr[y];
        if (b[y]) ++irr[x];
    }

    double l = 0.00, r = 1.00;

    cnt = 0;
    rep(i, 1, n) if (!b[i]) c[++cnt] = i;

    rep(i, 1, 100){
        double mid = (l + r) / 2;
        if (check(mid)) l = mid;
        else r = mid - eps;
    }

    printf("%d\n", ans[0]);
    rep(i, 1, ans[0]) printf("%d ", ans[i]);
    putchar(10);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int numCities, numRoads, numFortresses, cnt;
vector<vector<int>> graph;
vector<double> ratios;
vector<int> F, vis, neighbors;

void getRatios () {
    set<double> S;
    S.insert(1.0);
    S.insert(0.0);
    for (auto i : graph)
        for (int j=1; j<i.size(); ++j)
            S.insert(j*1.0/i.size());
    for (auto i : S)
        ratios.push_back(i);
}

bool taken(int s, int r) {
    if (F[s])
        return false;
    int required=ceil(graph[s].size()*ratios[r]);
    return required <= neighbors[s];
}

void dfs(int s,int r) {
    cnt--;
    vis[s]=true;
    for (auto i : graph[s]) {
        neighbors[i]--;
        #ifdef DEBUG
            assert(neighbors[i] >= 0);
        #endif
    }
    for (auto i : graph[s])
        if (!vis[i] && !taken(i,r))
            dfs(i,r);
}

bool possible (int s) {
    cnt=numCities;
    vis.assign(numCities, 0);
    for (int i=0; i<numCities; ++i)
        neighbors[i]=graph[i].size();
    for (int i=0; i<numCities; ++i)
        if (F[i] && !vis[i])
            dfs(i,s);
    return cnt!=0;
}

int main() {
    #ifdef DEBUG
        freopen("d.in","r",stdin);
    #else
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    #endif // DEBUG
    while (cin >> numCities >> numRoads >> numFortresses) {
        F.assign(numCities, 0);
        for (int i=0; i<numFortresses; ++i) {
            int a;
            cin >> a;
            F[a-1] = true;
        }
        graph.clear();
        graph.resize(numCities);
        for (int i=0; i<numRoads; ++i) {
            int from, to;
            cin >> from >> to;
            from--, to--;
            graph[from].push_back(to);
            graph[to].push_back(from);
        }
        getRatios();
        neighbors.resize(numCities);
        int st=0, en=ratios.size()-1;
        while (st + 1 < en) {
            int m=(st+en)/2;
            if (possible(m))
                st=m;
            else en=m-1;
        }
        if (!possible(en))
            possible(st);
        cout << cnt << "\n";
        for (int i=0; i<numCities; ++i)
            if (!vis[i])
                cout << i+1 << " ";
        cout << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int numCities, numRoads, numFortresses, cnt;
vector<vector<int>> graph;
vector<double> ratios;
vector<int> F, vis;

void getRatios () {
    set<double> S;
    S.insert(1.0);
    S.insert(0.0);
    for (auto i : graph)
        for (int j=1; j<i.size(); ++j)
            S.insert(j*1.0/i.size());
    for (auto i : S)
        ratios.push_back(i);
}

bool taken(int s, int r) {
    if (F[s])
        return false;
    int required=ceil(graph[s].size()*ratios[r]);
    for (auto i : graph[s])
        if (!vis[i])
            required--;
    return required <= 0;
}

void dfs(int s,int r) {
    cnt--;
    vis[s]=true;
    for (auto i : graph[s])
        if (!vis[i] && !taken(i,r))
            dfs(i,r);
}

bool possible (int s) {
    cnt=numCities;
    vis.assign(numCities, 0);
    for (int i=0; i<numCities; ++i)
        if (F[i] && !vis[i])
            dfs(i,s);
    return cnt!=0;
}

int main() {
    #ifdef DEBUG
        freopen("d.in","r",stdin);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    while (cin >> numCities >> numRoads >> numFortresses) {
        F.assign(numCities, 0);
        for (int i=0; i<numFortresses; ++i) {
            int a;
            cin >> a;
            F[a-1] = true;
        }
        graph.clear();
        graph.resize(numCities);
        for (int i=0; i<numRoads; ++i) {
            int from, to;
            cin >> from >> to;
            from--, to--;
            graph[from].push_back(to);
            graph[to].push_back(from);
        }
        getRatios();
        int st=0, en=ratios.size()-1;
        while (st + 1 < en) {
            int m=(st+en)/2;
            if (possible(m))
                st=m;
            else en=m-1;
        }
        if (!possible(en))
            possible(st);
        cout << cnt << "\n";
        for (int i=0; i<numCities; ++i)
            if (!vis[i])
                cout << i+1 << " ";
        cout << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int numCities, numRoads, numFortresses, cnt;
vector<vector<int>> graph;
vector<double> ratios;
vector<int> F, vis;

void getRatios () {
    set<double> S;
    S.insert(1.0);
    S.insert(0.0);
    for (auto i : graph)
        for (int j=1; j<i.size(); ++j)
            S.insert(j*1.0/i.size());
    for (auto i : S)
        ratios.push_back(i);
}

bool taken(int s, int r) {
    if (F[s])
        return false;
    int required=ceil(graph[s].size()*ratios[r]);
    for (auto i : graph[s])
        if (!vis[i])
            required--;
    return required <= 0;
}

void dfs(int s,int r) {
    cnt--;
    vis[s]=true;
    for (auto i : graph[s])
        if (!vis[i] && !taken(i,r))
            dfs(i,r);
}

bool possible (int s) {
    cnt=numCities;
    vis.assign(numCities, 0);
    for (int i=0; i<numCities; ++i)
        if (F[i] && !vis[i])
            dfs(i,s);
    return cnt!=0;
}

int main() {
    #ifdef DEBUG
        freopen("d.in","r",stdin);
    #endif
    while (cin >> numCities >> numRoads >> numFortresses) {
        F.assign(numCities, 0);
        for (int i=0; i<numFortresses; ++i) {
            int a;
            cin >> a;
            F[a-1] = true;
        }
        graph.clear();
        graph.resize(numCities);
        for (int i=0; i<numRoads; ++i) {
            int from, to;
            cin >> from >> to;
            from--, to--;
            graph[from].push_back(to);
            graph[to].push_back(from);
        }
        getRatios();
        int st=0, en=ratios.size()-1;
        while (st + 1 < en) {
            int m=(st+en)/2;
            if (possible(m))
                st=m;
            else en=m-1;
        }
        if (!possible(en))
            possible(st);
        cout << cnt << "\n";
        for (int i=0; i<numCities; ++i)
            if (!vis[i])
                cout << i+1 << " ";
        cout << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1e6 + 7;

#define mp make_pair
#define ff first
#define ss second
#define sz(x) (((int)x.size()))
#define cerr if(0)cerr

typedef double dd;

int dw[N], dw2[N], f[N], vis[N], vis2[N];
vector<int> a[N];
set<pair<dd, int > > s, s2;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n, m, k; cin >> n >> m >> k;
    for (int i = 0; i < k; i++){
        int x; cin >> x;
        f[x]++;
    }
    for (int i = 0; i < m; i++){
        int x, y; cin >> x >> y;
        a[x].push_back(y);
        a[y].push_back(x);
        if (f[x])
            dw[y]--, dw2[y]--;
        if (f[y])
            dw[x]--, dw2[x]--;
    }
    for(int i = 1; i <= n; i++)
        if (!f[i]){
            cerr << i << ' ' << ((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])) << endl;
            s.insert(mp(((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])), i));
            s2.insert(mp(((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])), i));
        }
        else
            vis[i] ++, vis2[i]++;

    int step = 0 , anp = 0;
    dd ans = 0;

    cerr << '\n';
    while (!s.empty()){
        dd y = s.begin()->ff;
        int x = s.begin()->ss;
        cerr << x << ' ' << y << '\n';
        vis[x]++, step++;
        s.erase(s.begin());
        if (y > ans)
            ans = y, anp = step;
        for(auto i : a[x]) if(!vis[i]){
            dd g = ((dd)(sz(a[i])+dw[i])/(dd)sz(a[i]));
            s.erase(s.find(mp(g, i)));
            dw[i]--;
            s.insert(mp(((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])), i));
        }
    }
    step = 1;
    cerr << '\n';
    while (step != anp){
        dd y = s2.begin()->ff;
        int x = s2.begin()->ss;
        cerr << x << ' ' << y << '\n';
        vis2[x]++, step++;
        s2.erase(s2.begin());
        for(auto i : a[x]) if(!vis2[i]){
            cerr << i << '\n';
            dd g = ((dd)(sz(a[i])+dw2[i])/(dd)sz(a[i]));
            s2.erase(s2.find(mp(g, i)));
            dw2[i]--;
            s2.insert(mp(((dd)(sz(a[i])+dw2[i])/(dd)sz(a[i])), i));
        }
    }
    cout << sz(s2) << '\n';
    for (auto i : s2)
        cout << (i.ss) << ' ';
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1e6 + 7;

#define mp make_pair
#define ff first
#define ss second
#define sz(x) (((int)x.size()))
#define cerr if(0)cerr

typedef double dd;

int dw[N], dw2[N], f[N], vis[N], vis2[N];
vector<int> a[N];
set<pair<dd, int > > s, s2;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n, m, k; cin >> n >> m >> k;
    for (int i = 0; i < k; i++){
        int x; cin >> x;
        f[x]++;
    }
    for (int i = 0; i < m; i++){
        int x, y; cin >> x >> y;
        a[x].push_back(y);
        a[y].push_back(x);
        if (f[x])
            dw[y]--, dw2[y]--;
        if (f[y])
            dw[x]--, dw2[x]--;
    }
    for(int i = 1; i <= n; i++)
        if (!f[i]){
            cerr << i << ' ' << ((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])) << endl;
            s.insert(mp(((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])), i));
            s2.insert(mp(((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])), i));
        }
        else
            vis[i] ++, vis2[i]++;

    int step = 0 , ans = 0, anp = 0;
    cerr << '\n';
    while (!s.empty()){
        dd y = s.begin()->ff;
        int x = s.begin()->ss;
        cerr << x << ' ' << y << '\n';
        vis[x]++, step++;
        s.erase(s.begin());
        if (y > ans)
            ans = y, anp = step;
        for(auto i : a[x]) if(!vis[i]){
            dd g = ((dd)(sz(a[i])+dw[i])/(dd)sz(a[i]));
            s.erase(s.find(mp(g, i)));
            dw[i]--;
            s.insert(mp(((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])), i));
        }
    }
    step = 1;
    cerr << '\n';
    while (step != anp){
        dd y = s2.begin()->ff;
        int x = s2.begin()->ss;
        cerr << x << ' ' << y << '\n';
        vis2[x]++, step++;
        s2.erase(s2.begin());
        for(auto i : a[x]) if(!vis2[i]){
            cerr << i << '\n';
            dd g = ((dd)(sz(a[i])+dw2[i])/(dd)sz(a[i]));
            s2.erase(s2.find(mp(g, i)));
            dw2[i]--;
            s2.insert(mp(((dd)(sz(a[i])+dw2[i])/(dd)sz(a[i])), i));
        }
    }
    cout << sz(s2) << '\n';
    for (auto i : s2)
        cout << (i.ss) << ' ';
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1e6 + 7;

#define mp make_pair
#define ff first
#define ss second
#define sz(x) (((int)x.size()))
#define cerr if(0)cerr

typedef double dd;

int dw[N], dw2[N], f[N], vis[N], vis2[N];
vector<int> a[N];
set<pair<dd, int > > s, s2;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n, m, k; cin >> n >> m >> k;
    for (int i = 0; i < k; i++){
        int x; cin >> x;
        f[x]++;
    }
    for (int i = 0; i < m; i++){
        int x, y; cin >> x >> y;
        a[x].push_back(y);
        a[y].push_back(x);
        if (f[x])
            dw[y]--, dw2[y]--;
        if (f[y])
            dw[x]--, dw2[x]--;
    }
    for(int i = 1; i <= n; i++)
        if (!f[i]){
            cerr << i << ' ' << ((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])) << endl;
            s.insert(mp(((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])), i));
            s2.insert(mp(((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])), i));
        }
        else
            vis[i] ++, vis2[i]++;

    int step = 0 , anp = 0;
    dd ans = -1;

    cerr << '\n';
    while (!s.empty()){
        dd y = s.begin()->ff;
        int x = s.begin()->ss;
        cerr << x << ' ' << y << '\n';
        vis[x]++, step++;
        s.erase(s.begin());
        if (y > ans)
            ans = y, anp = step;
        for(auto i : a[x]) if(!vis[i]){
            dd g = ((dd)(sz(a[i])+dw[i])/(dd)sz(a[i]));
            s.erase(s.find(mp(g, i)));
            dw[i]--;
            s.insert(mp(((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])), i));
        }
    }
    step = 1;
    cerr << '\n';
    while (step != anp){
        dd y = s2.begin()->ff;
        int x = s2.begin()->ss;
        cerr << x << ' ' << y << '\n';
        vis2[x]++, step++;
        s2.erase(s2.begin());
        for(auto i : a[x]) if(!vis2[i]){
            cerr << i << '\n';
            dd g = ((dd)(sz(a[i])+dw2[i])/(dd)sz(a[i]));
            s2.erase(s2.find(mp(g, i)));
            dw2[i]--;
            s2.insert(mp(((dd)(sz(a[i])+dw2[i])/(dd)sz(a[i])), i));
        }
    }
    cout << sz(s2) << '\n';
    for (auto i : s2)
        cout << (i.ss) << ' ';
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1e6 + 7;

#define mp make_pair
#define ff first
#define ss second
#define sz(x) (((int)x.size()))
#define cerr if(0)cerr

typedef double dd;

int dw[N], dw2[N], f[N], vis[N], vis2[N];
vector<int> a[N];
set<pair<dd, int > > s, s2;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n, m, k; cin >> n >> m >> k;
    for (int i = 0; i < k; i++){
        int x; cin >> x;
        f[x]++;
    }
    for (int i = 0; i < m; i++){
        int x, y; cin >> x >> y;
        a[x].push_back(y);
        a[y].push_back(x);
        if (f[x])
            dw[y]--, dw2[y]--;
        if (f[y])
            dw[x]--, dw2[x]--;
    }
    for(int i = 1; i <= n; i++)
        if (!f[i]){
            cout << i << ' ' << ((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])) << endl;
            s.insert(mp(((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])), i));
            s2.insert(mp(((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])), i));
        }
        else
            vis[i] ++, vis2[i]++;

    int step = 0 , ans = 0, anp = 0;
    cerr << '\n';
    while (!s.empty()){
        dd y = s.begin()->ff;
        int x = s.begin()->ss;
        cerr << x << ' ' << y << '\n';
        vis[x]++, step++;
        s.erase(s.begin());
        if (y > ans)
            ans = y, anp = step;
        for(auto i : a[x]) if(!vis[i]){
            dd g = ((dd)(sz(a[i])+dw[i])/(dd)sz(a[i]));
            s.erase(s.find(mp(g, i)));
            dw[i]--;
            s.insert(mp(((dd)(sz(a[i])+dw[i])/(dd)sz(a[i])), i));
        }
    }
    step = 1;
    cerr << '\n';
    while (step != anp){
        dd y = s2.begin()->ff;
        int x = s2.begin()->ss;
        cerr << x << ' ' << y << '\n';
        vis2[x]++, step++;
        s2.erase(s2.begin());
        for(auto i : a[x]) if(!vis2[i]){
            cerr << i << '\n';
            dd g = ((dd)(sz(a[i])+dw2[i])/(dd)sz(a[i]));
            s2.erase(s2.find(mp(g, i)));
            dw2[i]--;
            s2.insert(mp(((dd)(sz(a[i])+dw2[i])/(dd)sz(a[i])), i));
        }
    }
    cout << sz(s2) << '\n';
    for (auto i : s2)
        cout << (i.ss) << ' ';
}


// Enjoy your stay.

#include <bits/stdc++.h>

//#define long long long
#define LOOPVAR_TYPE long

#define all(x) (x).begin(), (x).end()
#define sz(x) ((LOOPVAR_TYPE)(x).size())
#define foreach(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i, n) _rep2(i, 0, n)
#define _rep2(i, a, b) for(LOOPVAR_TYPE i = (LOOPVAR_TYPE)(a); i < (LOOPVAR_TYPE)(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)

#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple
#define pb push_back

const double EPS = 1e-9;
const double PI = acos(-1.0);
const long INF = 1070000000LL;
const long MOD = 1000000007LL;

using namespace std;

typedef istringstream iss;
typedef stringstream sst;
typedef pair<LOOPVAR_TYPE, LOOPVAR_TYPE> pi;
typedef vector<LOOPVAR_TYPE> vi;

int n, m, k;
int ok[100010];
vi g[100010];
vi ans;
int total[100010];
int total2[100010];
int need[100010];
int st[100010];
int used[100010];

int main(){
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);

	cin >> n >> m >> k;
	fill(ok, ok+n, 1);
	rep(i, k){
		int a;
		cin >> a;
		a--;
		ok[a] = 0;
	}
	rep(i, m){
		int a, b;
		cin >> a >> b;
		a--, b--;
		g[a].pb(b);
		g[b].pb(a);
		total[a]++;
		total[b]++;
		total2[a] += ok[b];
		total2[b] += ok[a];
	}
	long double lo = -0.1, hi = 1.1;
	rep(_, 100){
		long double mi = (lo + hi) / 2;
		rep(i, n) if(ok[i]){
			need[i] = total[i] * mi + 1;
		}
		fill(used, used+n, 1);
		queue<int> Q;
		rep(i, n) if(ok[i]){
			st[i] = total2[i];
			if(st[i] < need[i]){
				Q.push(i);
			}
		}
		int num = n - k;
		int loop = 0;
		while(sz(Q)){
			loop++;
			int v = Q.front();
			Q.pop();
			if(used[v] == 0) continue;
			used[v] = 0;
			num--;
			for(int w: g[v]){
				if(ok[w] && used[w]){
					st[w]--;
					if(st[w] < need[w]){
						Q.push(w);
					}
				}
			}
		}
		assert(loop <= 2*m);
		if(num > 0){
			ans.clear();
			rep(i, n) if(ok[i] && used[i]) ans.pb(i+1);
			lo = mi;
		}else{
			hi = mi;
		}
	}
	cout<<sz(ans)<<endl;
	for(int x: ans) cout<<x<<" ";
}


// Enjoy your stay.

#include <bits/stdc++.h>

//#define long long long
#define LOOPVAR_TYPE long

#define all(x) (x).begin(), (x).end()
#define sz(x) ((LOOPVAR_TYPE)(x).size())
#define foreach(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i, n) _rep2(i, 0, n)
#define _rep2(i, a, b) for(LOOPVAR_TYPE i = (LOOPVAR_TYPE)(a); i < (LOOPVAR_TYPE)(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)

#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple
#define pb push_back

const double EPS = 1e-9;
const double PI = acos(-1.0);
const long INF = 1070000000LL;
const long MOD = 1000000007LL;

using namespace std;

typedef istringstream iss;
typedef stringstream sst;
typedef pair<LOOPVAR_TYPE, LOOPVAR_TYPE> pi;
typedef vector<LOOPVAR_TYPE> vi;

int n, m, k;
int ok[100010];
vi g[100010];
vi ans;
int total[100010];
int total2[100010];
int need[100010];
int st[100010];
int used[100010];

int main(){
	//cin.tie(NULL);
	//ios_base::sync_with_stdio(false);

	cin >> n >> m >> k;
	fill(ok, ok+n, 1);
	rep(i, k){
		int a;
		scanf("%d",&a);//cin >> a;
		a--;
		ok[a] = 0;
	}
	rep(i, m){
		int a, b;
		scanf("%d %d",&a,&b);//cin >> a >> b;
		a--, b--;
		g[a].pb(b);
		g[b].pb(a);
		total[a]++;
		total[b]++;
		total2[a] += ok[b];
		total2[b] += ok[a];
	}
	long double lo = -0.1, hi = 1.1;
	rep(_, 100){
		long double mi = (lo + hi) / 2;
		rep(i, n) if(ok[i]){
			need[i] = total[i] * mi + 1;
		}
		fill(used, used+n, 1);
		queue<int> Q;
		rep(i, n) if(ok[i]){
			st[i] = total2[i];
			if(st[i] < need[i]){
				Q.push(i);
			}
		}
		int num = n - k;
		while(sz(Q)){
			int v = Q.front();
			Q.pop();
			if(used[v] == 0) continue;
			used[v] = 0;
			num--;
			for(int w: g[v]){
				if(ok[w] && used[w]){
					st[w]--;
					if(st[w] < need[w]){
						Q.push(w);
					}
				}
			}
		}
		if(num > 0){
			ans.clear();
			rep(i, n) if(ok[i] && used[i]) ans.pb(i+1);
			lo = mi;
		}else{
			hi = mi;
		}
	}
	cout<<sz(ans)<<endl;
	for(int x: ans) printf("%d ",x);//cout<<x<<" ";
}


// Enjoy your stay.

#include <bits/stdc++.h>

//#define long long long
#define LOOPVAR_TYPE long

#define all(x) (x).begin(), (x).end()
#define sz(x) ((LOOPVAR_TYPE)(x).size())
#define foreach(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i, n) _rep2(i, 0, n)
#define _rep2(i, a, b) for(LOOPVAR_TYPE i = (LOOPVAR_TYPE)(a); i < (LOOPVAR_TYPE)(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)

#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple
#define pb push_back

const double EPS = 1e-9;
const double PI = acos(-1.0);
const long INF = 1070000000LL;
const long MOD = 1000000007LL;

using namespace std;

typedef istringstream iss;
typedef stringstream sst;
typedef pair<LOOPVAR_TYPE, LOOPVAR_TYPE> pi;
typedef vector<LOOPVAR_TYPE> vi;

int n, m, k;
int ok[100010];
vi g[100010];
vi ans;
int total[100010];
int total2[100010];
int need[100010];
int st[100010];
int used[100010];

int main(){
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);

	cin >> n >> m >> k;
	fill(ok, ok+n, 1);
	rep(i, k){
		int a;
		cin >> a;
		a--;
		ok[a] = 0;
	}
	rep(i, m){
		int a, b;
		cin >> a >> b;
		a--, b--;
		g[a].pb(b);
		g[b].pb(a);
		total[a]++;
		total[b]++;
		total2[a] += ok[b];
		total2[b] += ok[a];
	}
	long double lo = -0.1, hi = 1.1;
	rep(_, 100){
		/*long */double mi = (lo + hi) / 2;
		rep(i, n) if(ok[i]){
			need[i] = total[i] * mi + 1;
		}
		fill(used, used+n, 1);
		queue<int> Q;
		rep(i, n) if(ok[i]){
			st[i] = total2[i];
			if(st[i] < need[i]){
				Q.push(i);
			}
		}
		int num = n - k;
		while(sz(Q)){
			int v = Q.front();
			Q.pop();
			if(used[v] == 0) continue;
			used[v] = 0;
			num--;
			for(int w: g[v]){
				if(ok[w] && used[w]){
					st[w]--;
					if(st[w] < need[w]){
						Q.push(w);
					}
				}
			}
		}
		if(num > 0){
			ans.clear();
			rep(i, n) if(ok[i] && used[i]) ans.pb(i+1);
			lo = mi;
		}else{
			hi = mi;
		}
	}
	cout<<sz(ans)<<endl;
	for(int x: ans) cout<<x<<" ";
}


// Enjoy your stay.

#include <bits/stdc++.h>

//#define long long long
#define LOOPVAR_TYPE long

#define all(x) (x).begin(), (x).end()
#define sz(x) ((LOOPVAR_TYPE)(x).size())
#define foreach(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i, n) _rep2(i, 0, n)
#define _rep2(i, a, b) for(LOOPVAR_TYPE i = (LOOPVAR_TYPE)(a); i < (LOOPVAR_TYPE)(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)

#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple
#define pb push_back

const double EPS = 1e-9;
const double PI = acos(-1.0);
const long INF = 1070000000LL;
const long MOD = 1000000007LL;

using namespace std;

typedef istringstream iss;
typedef stringstream sst;
typedef pair<LOOPVAR_TYPE, LOOPVAR_TYPE> pi;
typedef vector<LOOPVAR_TYPE> vi;

int n, m, k;
int ok[100010];
vi g[100010];
vi ans;
int total[100010];
int total2[100010];
int need[100010];
int st[100010];
int used[100010];

int main(){
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);

	cin >> n >> m >> k;
	fill(ok, ok+n, 1);
	rep(i, k){
		int a;
		cin >> a;
		a--;
		ok[a] = 0;
	}
	rep(i, m){
		int a, b;
		cin >> a >> b;
		a--, b--;
		g[a].pb(b);
		g[b].pb(a);
		total[a]++;
		total[b]++;
		total2[a] += ok[b];
		total2[b] += ok[a];
	}
	/*long */double lo = -0.1, hi = 1.1;
	int counter = 0;
	rep(_, 100){
		/*long */double mi = (lo + hi) / 2;
		rep(i, n) if(ok[i]){
			need[i] = total[i] * mi + 1;
		}
		fill(used, used+n, 1);
		queue<int> Q;
		rep(i, n) if(ok[i]){
			st[i] = total2[i];
			if(st[i] < need[i]){
				Q.push(i);
			}
		}
		int num = n - k;
		while(sz(Q)){
			counter++;
			int v = Q.front();
			Q.pop();
			if(used[v] == 0) continue;
			used[v] = 0;
			num--;
			for(int w: g[v]){
				if(ok[w] && used[w]){
					st[w]--;
					if(st[w] == need[w] - 1){
						Q.push(w);
					}
				}
			}
		}
		if(num > 0){
			ans.clear();
			rep(i, n) if(ok[i] && used[i]) ans.pb(i+1);
			lo = mi;
		}else{
			hi = mi;
		}
	}
	assert(counter <= n * 100);
	cout<<sz(ans)<<endl;
	for(int x: ans) cout<<x<<" ";
}


// Enjoy your stay.

#include <bits/stdc++.h>

//#define long long long
#define LOOPVAR_TYPE long

#define all(x) (x).begin(), (x).end()
#define sz(x) ((LOOPVAR_TYPE)(x).size())
#define foreach(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i, n) _rep2(i, 0, n)
#define _rep2(i, a, b) for(LOOPVAR_TYPE i = (LOOPVAR_TYPE)(a); i < (LOOPVAR_TYPE)(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)

#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple
#define pb push_back

const double EPS = 1e-9;
const double PI = acos(-1.0);
const long INF = 1070000000LL;
const long MOD = 1000000007LL;

using namespace std;

typedef istringstream iss;
typedef stringstream sst;
typedef pair<LOOPVAR_TYPE, LOOPVAR_TYPE> pi;
typedef vector<LOOPVAR_TYPE> vi;

int n, m, k;
int ok[100010];
vi g[100010];
vi ans;
int total[100010];
int total2[100010];
int need[100010];
int st[100010];
int used[100010];

int main(){
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);

	cin >> n >> m >> k;
	fill(ok, ok+n, 1);
	rep(i, k){
		int a;
		cin >> a;
		a--;
		ok[a] = 0;
	}
	rep(i, m){
		int a, b;
		cin >> a >> b;
		a--, b--;
		g[a].pb(b);
		g[b].pb(a);
		total[a]++;
		total[b]++;
		total2[a] += ok[b];
		total2[b] += ok[a];
	}
	/*long */double lo = -0.1, hi = 1.1;
	int counter = 0;
	rep(_, 100){
		/*long */double mi = (lo + hi) / 2;
		rep(i, n) if(ok[i]){
			need[i] = total[i] * mi + 1;
		}
		fill(used, used+n, 1);
		queue<int> Q;
		rep(i, n) if(ok[i]){
			st[i] = total2[i];
			if(st[i] < need[i]){
				Q.push(i);
			}
		}
		int num = n - k;
		while(sz(Q)){
			counter++;
			int v = Q.front();
			Q.pop();
			if(used[v] == 0) continue;
			used[v] = 0;
			num--;
			for(int w: g[v]){
				if(ok[w] && used[w]){
					st[w]--;
					if(st[w] < need[w]){
						Q.push(w);
					}
				}
			}
		}
		if(num > 0){
			ans.clear();
			rep(i, n) if(ok[i] && used[i]) ans.pb(i+1);
			lo = mi;
		}else{
			hi = mi;
		}
	}
	assert(counter <= 200 * m);
	cout<<sz(ans)<<endl;
	for(int x: ans) cout<<x<<" ";
}


// Enjoy your stay.

#include <bits/stdc++.h>

//#define long long long
#define LOOPVAR_TYPE long

#define all(x) (x).begin(), (x).end()
#define sz(x) ((LOOPVAR_TYPE)(x).size())
#define foreach(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i, n) _rep2(i, 0, n)
#define _rep2(i, a, b) for(LOOPVAR_TYPE i = (LOOPVAR_TYPE)(a); i < (LOOPVAR_TYPE)(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)

#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple
#define pb push_back

const double EPS = 1e-9;
const double PI = acos(-1.0);
const long INF = 1070000000LL;
const long MOD = 1000000007LL;

using namespace std;

typedef istringstream iss;
typedef stringstream sst;
typedef pair<LOOPVAR_TYPE, LOOPVAR_TYPE> pi;
typedef vector<LOOPVAR_TYPE> vi;

int n, m, k;
int ok[100010];
vi g[100010];
vi ans;
int total[100010];
int total2[100010];
int need[100010];
int st[100010];
int used[100010];

int main(){
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);

	cin >> n >> m >> k;
	fill(ok, ok+n, 1);
	rep(i, k){
		int a;
		cin >> a;
		a--;
		ok[a] = 0;
	}
	rep(i, m){
		int a, b;
		cin >> a >> b;
		a--, b--;
		g[a].pb(b);
		g[b].pb(a);
		total[a]++;
		total[b]++;
		total2[a] += ok[b];
		total2[b] += ok[a];
	}
	/*long */double lo = -0.1, hi = 1.1;
	int counter = 0;
	rep(_, 100){
		/*long */double mi = (lo + hi) / 2;
		rep(i, n) if(ok[i]){
			need[i] = total[i] * mi + 1;
		}
		fill(used, used+n, 1);
		queue<int> Q;
		rep(i, n) if(ok[i]){
			st[i] = total2[i];
			if(st[i] < need[i]){
				Q.push(i);
			}
		}
		int num = n - k;
		while(sz(Q)){
			int v = Q.front();
			Q.pop();
			if(used[v] == 0) continue;
			used[v] = 0;
			num--;
			for(int w: g[v]){
				counter++;
				if(ok[w] && used[w]){
					st[w]--;
					if(st[w] == need[w] - 1){
						Q.push(w);
					}
				}
			}
		}
		if(num > 0){
			ans.clear();
			rep(i, n) if(ok[i] && used[i]) ans.pb(i+1);
			lo = mi;
		}else{
			hi = mi;
		}
	}
	assert(counter <= 100 * 2 * m);
	cout<<sz(ans)<<endl;
	for(int x: ans) cout<<x<<" ";
}


// Enjoy your stay.

#include <bits/stdc++.h>

//#define long long long
#define LOOPVAR_TYPE long

#define all(x) (x).begin(), (x).end()
#define sz(x) ((LOOPVAR_TYPE)(x).size())
#define foreach(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i, n) _rep2(i, 0, n)
#define _rep2(i, a, b) for(LOOPVAR_TYPE i = (LOOPVAR_TYPE)(a); i < (LOOPVAR_TYPE)(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)

#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple
#define pb push_back

const double EPS = 1e-9;
const double PI = acos(-1.0);
const long INF = 1070000000LL;
const long MOD = 1000000007LL;

using namespace std;

typedef istringstream iss;
typedef stringstream sst;
typedef pair<LOOPVAR_TYPE, LOOPVAR_TYPE> pi;
typedef vector<LOOPVAR_TYPE> vi;

int n, m, k;
int ok[100010];
vi g[100010];
vi ans;
int total[100010];
int total2[100010];
int need[100010];
int st[100010];
int used[100010];

int main(){
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);

	cin >> n >> m >> k;
	fill(ok, ok+n, 1);
	rep(i, k){
		int a;
		cin >> a;
		a--;
		ok[a] = 0;
	}
	rep(i, m){
		int a, b;
		cin >> a >> b;
		a--, b--;
		g[a].pb(b);
		g[b].pb(a);
		total[a]++;
		total[b]++;
		total2[a] += ok[b];
		total2[b] += ok[a];
	}
	long double lo = -0.1, hi = 1.1;
	rep(_, 100){
		long double mi = (lo + hi) / 2;
		rep(i, n) if(ok[i]){
			need[i] = total[i] * mi + 1;
		}
		fill(used, used+n, 1);
		queue<int> Q;
		rep(i, n) if(ok[i]){
			st[i] = total2[i];
			if(st[i] < need[i]){
				Q.push(i);
			}
		}
		int num = n - k;
		while(sz(Q)){
			int v = Q.front();
			Q.pop();
			if(used[v] == 0) continue;
			used[v] = 0;
			num--;
			for(int w: g[v]){
				if(ok[w] && used[w]){
					st[w]--;
					if(st[w] < need[w]){
						Q.push(w);
					}
				}
			}
		}
		if(num > 0){
			ans.clear();
			rep(i, n) if(ok[i] && used[i]) ans.pb(i+1);
			lo = mi;
		}else{
			hi = mi;
		}
	}
	cout<<sz(ans)<<endl;
	for(int x: ans) cout<<x<<" ";
}


// Enjoy your stay.

#include <bits/stdc++.h>

//#define long long long
#define LOOPVAR_TYPE long

#define all(x) (x).begin(), (x).end()
#define sz(x) ((LOOPVAR_TYPE)(x).size())
#define foreach(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i, n) _rep2(i, 0, n)
#define _rep2(i, a, b) for(LOOPVAR_TYPE i = (LOOPVAR_TYPE)(a); i < (LOOPVAR_TYPE)(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)

#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple
#define pb push_back

const double EPS = 1e-9;
const double PI = acos(-1.0);
const long INF = 1070000000LL;
const long MOD = 1000000007LL;

using namespace std;

typedef istringstream iss;
typedef stringstream sst;
typedef pair<LOOPVAR_TYPE, LOOPVAR_TYPE> pi;
typedef vector<LOOPVAR_TYPE> vi;

int n, m, k;
int ok[100010];
vi g[100010];
vi ans;
int total[100010];
int total2[100010];
int need[100010];
int st[100010];
int used[100010];

int main(){
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);

	cin >> n >> m >> k;
	fill(ok, ok+n, 1);
	rep(i, k){
		int a;
		cin >> a;
		a--;
		ok[a] = 0;
	}
	rep(i, m){
		int a, b;
		cin >> a >> b;
		a--, b--;
		g[a].pb(b);
		g[b].pb(a);
		total[a]++;
		total[b]++;
		total2[a] += ok[b];
		total2[b] += ok[a];
	}
	/*long */double lo = -0.1, hi = 1.1;
	rep(_, 100){
		/*long */double mi = (lo + hi) / 2;
		rep(i, n) if(ok[i]){
			need[i] = total[i] * mi + 1;
		}
		fill(used, used+n, 1);
		queue<int> Q;
		rep(i, n) if(ok[i]){
			st[i] = total2[i];
			if(st[i] < need[i]){
				Q.push(i);
			}
		}
		int num = n - k;
		while(sz(Q)){
			int v = Q.front();
			Q.pop();
			if(used[v] == 0) continue;
			used[v] = 0;
			num--;
			for(int w: g[v]){
				if(ok[w] && used[w]){
					st[w]--;
					if(st[w] < need[w]){
						Q.push(w);
					}
				}
			}
		}
		if(num > 0){
			ans.clear();
			rep(i, n) if(ok[i] && used[i]) ans.pb(i+1);
			lo = mi;
		}else{
			hi = mi;
		}
	}
	cout<<sz(ans)<<endl;
	for(int x: ans) cout<<x<<" ";
}


// Enjoy your stay.

#include <bits/stdc++.h>

//#define long long long
#define LOOPVAR_TYPE long

#define all(x) (x).begin(), (x).end()
#define sz(x) ((LOOPVAR_TYPE)(x).size())
#define foreach(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i, n) _rep2(i, 0, n)
#define _rep2(i, a, b) for(LOOPVAR_TYPE i = (LOOPVAR_TYPE)(a); i < (LOOPVAR_TYPE)(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)

#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple
#define pb push_back

const double EPS = 1e-9;
const double PI = acos(-1.0);
const long INF = 1070000000LL;
const long MOD = 1000000007LL;

using namespace std;

typedef istringstream iss;
typedef stringstream sst;
typedef pair<LOOPVAR_TYPE, LOOPVAR_TYPE> pi;
typedef vector<LOOPVAR_TYPE> vi;

int n, m, k;
int ok[100010];
vi g[100010];
vi ans;
int total[100010];
int total2[100010];
int need[100010];
int st[100010];
int used[100010];

int main(){
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);

	cin >> n >> m >> k;
	fill(ok, ok+n, 1);
	rep(i, k){
		int a;
		cin >> a;
		a--;
		ok[a] = 0;
	}
	rep(i, m){
		int a, b;
		cin >> a >> b;
		a--, b--;
		g[a].pb(b);
		g[b].pb(a);
		total[a]++;
		total[b]++;
		total2[a] += ok[b];
		total2[b] += ok[a];
	}
	/*long */double lo = -0.1, hi = 1.1;
	rep(_, 100){
		/*long */double mi = (lo + hi) / 2;
		rep(i, n) if(ok[i]){
			need[i] = total[i] * mi + 1;
		}
		fill(used, used+n, 1);
		queue<int> Q;
		rep(i, n) if(ok[i]){
			st[i] = total2[i];
			if(st[i] < need[i]){
				Q.push(i);
			}
		}
		int num = n - k;
		while(sz(Q)){
			int v = Q.front();
			Q.pop();
			if(used[v] == 0) continue;
			used[v] = 0;
			num--;
			for(int w: g[v]){
				if(ok[w] && used[w]){
					st[w]--;
					if(st[w] == need[w] - 1){
						Q.push(w);
					}
				}
			}
		}
		if(num > 0){
			ans.clear();
			rep(i, n) if(ok[i] && used[i]) ans.pb(i+1);
			lo = mi;
		}else{
			hi = mi;
		}
	}
	cout<<sz(ans)<<endl;
	for(int x: ans) cout<<x<<" ";
}


#include<bits/stdc++.h>
#define rg register
#define dou double
#define fp( i , x , y ) for( rg int i=(x); i<=(y); ++i )
#define fq( i , x , y ) for( rg int i=(y); i>=(x); --i )
using namespace std ;
const int N = 1e5+10 ;
const dou eps = 1e-8 ;
vector <int> v[N] ;
int n , a[N] , m , q[N] , in[N] , nin[N] , k ;
bool has[N] ;  vector <int> ans ;
bool check( dou V ) {
 // printf( "Now : %.3lf\n" , x ) ;
  fp( i , 1 , n ) nin[i] = in[i] , has[i] = 0 ;
   int l = 1 , r = 0 ;
   fp( i , 1 , k ) q[++r] = a[i] , has[a[i]] = 1 ;
   while( l <= r ) {
     int x = q[l++] , lx = v[x].size( )-1 , y ;
   //  printf( "%d\n" , x ) ;
	 fp( i , 0 , lx ) {
	    y = v[x][i] ;
		if( has[y] ) continue ;
		nin[y] -- ;
	    dou scr = (dou)nin[y] / (dou)in[y] ;
		if( scr < V ) {
	//	   printf( "%.3lf %d %d %d\n" , scr , y , nin[y] , in[y] ) ;
		  q[++r] = y , has[y] = 1 ;
		}
	 }
   }
   ans.clear( ) ;
   bool flag = 0 ;
   fp( i , 1 , n )
     if( !has[i] ) { ans.push_back(i) ; flag=1; }
   return flag ;
}
signed main( ) {
   int x , y ;
   scanf( "%d %d %d" , &n , &m , &k ) ;
   fp( i , 1 , k ) scanf( "%d" , &a[i] ) ;
   fp( i , 1 , m ) {
     scanf( "%d %d" , &x , &y ) ;
     v[x].push_back(y) ;
     v[y].push_back(x) ;
     in[x] ++ ; in[y] ++ ;
   }
   dou l = 0.0 , r = 1.0 , mid ;
   while( r-l > eps ) {
     mid = (l+r)/2.0 ;
     if( check(mid) ) l = mid ;
      else r = mid ;
   }
   int la = ans.size( ) ;
   printf( "%d\n" , la ) ;
   fp( i , 0 , la-1 )
     printf( "%d " , ans[i] ) ; printf( "\n" ) ;
   return 0 ;
}


#include<bits/stdc++.h>
#define rg register
#define dou double
#define fp( i , x , y ) for( rg int i=(x); i<=(y); ++i )
#define fq( i , x , y ) for( rg int i=(y); i>=(x); --i )
using namespace std ;
const int N = 1e5+10 ;
const dou eps = 1e-8 ;
vector <int> v[N] ;
int n , a[N] , m , q[N] , in[N] , nin[N] , k ;
bool has[N] ;  vector <int> ans , tans ;
bool check( dou V ) {
 // printf( "Now : %.3lf\n" , x ) ;
  fp( i , 1 , n ) nin[i] = in[i] , has[i] = 0 ;
   int l = 1 , r = 0 ;
   fp( i , 1 , k ) q[++r] = a[i] , has[a[i]] = 1 ;
   while( l <= r ) {
     int x = q[l++] , lx = v[x].size( )-1 , y ;
   //  printf( "%d\n" , x ) ;
	 fp( i , 0 , lx ) {
	    y = v[x][i] ;
		if( has[y] ) continue ;
		nin[y] -- ;
	    dou scr = (dou)nin[y] / (dou)in[y] ;
		if( scr < V ) {
	//	   printf( "%.3lf %d %d %d\n" , scr , y , nin[y] , in[y] ) ;
		  q[++r] = y , has[y] = 1 ;
		}
	 }
   }
   tans.clear( ) ;
   bool flag = 0 ;
   fp( i , 1 , n )
     if( !has[i] ) { tans.push_back(i) ; flag=1; }
    if( !flag ) return 0 ;
    ans = tans ; return 1 ;
}
signed main( ) {
   int x , y ;
   scanf( "%d %d %d" , &n , &m , &k ) ;
   fp( i , 1 , k ) scanf( "%d" , &a[i] ) ;
   fp( i , 1 , m ) {
     scanf( "%d %d" , &x , &y ) ;
     v[x].push_back(y) ;
     v[y].push_back(x) ;
     in[x] ++ ; in[y] ++ ;
   }
   dou l = 0.0 , r = 1.0 , mid ;
   while( r-l > eps ) {
     mid = (l+r)/2.0 ;
     if( check(mid) ) l = mid ;
      else r = mid ;
   }
   int la = ans.size( ) ;
   printf( "%d\n" , la ) ;
   fp( i , 0 , la-1 )
     printf( "%d " , ans[i] ) ; printf( "\n" ) ;
   return 0 ;
}


#include<bits/stdc++.h>
#define rg register
#define dou double
#define fp( i , x , y ) for( rg int i=(x); i<=(y); ++i )
#define fq( i , x , y ) for( rg int i=(y); i>=(x); --i )
using namespace std ;
const int N = 1e5+10 ;
const dou eps = 1e-8 ;
vector <int> v[N] ;
int n , a[N] , m , q[N] , in[N] , nin[N] , k ;
bool has[N] ;  vector <int> ans , tans ;
bool check( dou V ) {
 // printf( "Now : %.3lf\n" , x ) ;
  fp( i , 1 , n ) nin[i] = in[i] , has[i] = 0 ;
   int l = 1 , r = 0 ;
   fp( i , 1 , k ) q[++r] = a[i] , has[a[i]] = 1 ;
   while( l <= r ) {
     int x = q[l++] , lx = v[x].size( )-1 , y ;
   //  printf( "%d\n" , x ) ;
	 fp( i , 0 , lx ) {
	    y = v[x][i] ;
		if( has[y] ) continue ;
		nin[y] -- ;
	    dou scr = (dou)nin[y] / (dou)in[y] ;
		if( scr < V ) {
	//	   printf( "%.3lf %d %d %d\n" , scr , y , nin[y] , in[y] ) ;
		  q[++r] = y , has[y] = 1 ;
		}
	 }
   }
   tans.clear( ) ;
   bool flag = 0 ;
   fp( i , 1 , n )
     if( !has[i] ) { tans.push_back(i) ; flag=1; }
    if( !flag ) return 0 ;
    ans = tans ; return 1 ;
}
signed main( ) {
   int x , y ;
   scanf( "%d %d %d" , &n , &m , &k ) ;
   fp( i , 1 , k ) scanf( "%d" , &a[i] ) ;
   fp( i , 1 , m ) {
     scanf( "%d %d" , &x , &y ) ;
     v[x].push_back(y) ;
     v[y].push_back(x) ;
     in[x] ++ ; in[y] ++ ;
   }
   dou l = 0.0 , r = 1.0 , mid ;
   while( r-l > eps ) {
     mid = (l+r)/2.0 ;
     if( check(mid) ) l = mid ;
      else r = mid ;
   }
   if( ans.size( ) == 0 ) check( 0.0 ) ;
   int la = ans.size( ) ;
   printf( "%d\n" , la ) ;
   fp( i , 0 , la-1 )
     printf( "%d " , ans[i] ) ; printf( "\n" ) ;
   return 0 ;
}


#include <bits/stdc++.h>

using namespace std;

const double eps = 1 / 1e7;

const int N = 2e5 + 300;

int n, m, k;
int a[N];
vector <int> g[N];
bool u[N];
int in[N], inv[N];
int stq, enq;
int st[N];

int main () {

	#ifdef LOCAL
	freopen ("in", "r", stdin);
	freopen ("out", "w", stdout);
	#endif

	cin >> n >> m >> k;

	for (int i = 1; i <= k; ++i)
		cin >> a[i];

	for (int i = 1; i <= m; ++i) {
		int x, y;
		cin >> x >> y;
		g[x].push_back (y);
		++in[x];
		g[y].push_back (x);
		++in[y];
	}

	double l = 0, r = 1;

	for (int cnt = 1; cnt <= 50; ++cnt) {
		double mid = (r + l) / 2;
		stq = enq = 0;
		memset (inv, 0, sizeof (inv));
		memset (u, 0, sizeof (u));
		for (int i = 1; i <= k; ++i)
			st[++enq] = a[i];
	    for (int i = 1; i <= k; ++i)
	    	u[a[i]] = 1;
	    while (stq < enq) {
			int v = st[++stq];
			for (auto to : g[v]) {
				++inv[to];
				if (!u[to] && inv[to] / 1.0 / in[to] > mid)
					st[++enq] = to, u[to] = 1;
			}
	    }
	    if (enq < n) {
	    	r = mid;
	    } else {
	    	l = mid;
	    }
	}

	stq = enq = 0;
	memset (inv, 0, sizeof (inv));
	memset (u, 0, sizeof (u));
	for (int i = 1; i <= k; ++i)
		st[++enq] = a[i];
    for (int i = 1; i <= k; ++i)
    	u[a[i]] = 1;

    while (stq < enq) {
		int v = st[++stq];
		for (auto to : g[v]) {
			++inv[to];
			if (!u[to] && inv[to] / 1.0 / in[to] > r) {
				st[++enq] = to, u[to] = 1;
			}
		}
    }

	memset (u, 0, sizeof (u));

	for (int i = 1; i <= enq; ++i)
		u[st[i]] = 1;

	vector <int> ans;

	for (int i = 1; i <= n; ++i)
		if (!u[i])
			ans.push_back (i);

	cout << ans.size () << "\n";

	for (auto v : ans)
		cout << v << " ";

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const double eps = 1 / 1e7;

const int N = 2e5 + 300;

int n, m, k;
int a[N];
vector <int> g[N];
bool u[N];
int in[N], inv[N];
int stq, enq;
int st[N];

int main () {

	#ifdef LOCAL
	freopen ("in", "r", stdin);
	freopen ("out", "w", stdout);
	#endif

	cin >> n >> m >> k;

	for (int i = 1; i <= k; ++i)
		cin >> a[i];

	for (int i = 1; i <= m; ++i) {
		int x, y;
		cin >> x >> y;
		g[x].push_back (y);
		++in[x];
		g[y].push_back (x);
		++in[y];
	}

	double l = 0, r = 1;

	for (int cnt = 1; cnt <= 50; ++cnt) {
		double mid = (r + l) / 2;
		stq = enq = 0;
		memset (inv, 0, sizeof (inv));
		for (int i = 1; i <= k; ++i)
			st[++enq] = a[i];
	    while (stq < enq) {
			int v = st[++stq];
			for (auto to : g[v]) {
				++inv[to];
				if (!u[to] && inv[to] / 1.0 / in[to] > mid)
					st[++enq] = to, u[to] = 1;
			}
	    }
	    if (enq != n) {
	    	l = mid;
	    } else {
	    	r = mid;
	    }
	}

	stq = enq = 0;
	memset (inv, 0, sizeof (inv));
	for (int i = 1; i <= k; ++i)
		st[++enq] = a[i];
    while (stq < enq) {
		int v = st[++stq];
		for (auto to : g[v]) {
			++inv[to];
			if (!u[to] && inv[to] / 1.0 / in[to] > l)
				st[++enq] = to, u[to] = 1;
		}
    }

	memset (u, 0, sizeof (u));

	for (int i = 1; i <= enq; ++i) {
		u[st[i]] = 1;
	}

	vector <int> ans;

	for (int i = 1; i <= n; ++i)
		if (!u[i])
			ans.push_back (i);

	cout << ans.size () << "\n";

	for (auto v : ans)
		cout << v << " ";

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const double eps = 1 / 1e7;

const int N = 2e5 + 300;

int n, m, k;
int a[N];
vector <int> g[N];
bool u[N];
int in[N], inv[N];
int stq, enq;
int st[N];

int main () {

	#ifdef LOCAL
	freopen ("in", "r", stdin);
	freopen ("out", "w", stdout);
	#endif

	scanf ("%d%d%d", &n, &m, &k);

	for (int i = 1; i <= k; ++i)
		scanf ("%d", &a[i]);

	for (int i = 1; i <= m; ++i) {
		int x, y;
		scanf ("%d%d", &x, &y);
		g[x].push_back (y);
		++in[x];
		g[y].push_back (x);
		++in[y];
	}

	double l = 0, r = 1;

	for (int cnt = 1; cnt <= 50; ++cnt) {
		double mid = (r + l) / 2;
		stq = enq = 0;
		memset (inv, 0, sizeof (inv));
		memset (u, 0, sizeof (u));
		for (int i = 1; i <= k; ++i)
			st[++enq] = a[i];
	    for (int i = 1; i <= k; ++i)
	    	u[a[i]] = 1;
	    while (stq < enq) {
			int v = st[++stq];
			for (auto to : g[v]) {
				++inv[to];
				if (!u[to] && inv[to] / 1.0 / in[to] > mid)
					st[++enq] = to, u[to] = 1;
			}
	    }
	    if (enq < n) {
	    	r = mid;
	    } else {
	    	l = mid;
	    }
	}

	stq = enq = 0;
	memset (inv, 0, sizeof (inv));
	memset (u, 0, sizeof (u));
	for (int i = 1; i <= k; ++i)
		st[++enq] = a[i];
    for (int i = 1; i <= k; ++i)
    	u[a[i]] = 1;

    while (stq < enq) {
		int v = st[++stq];
		for (auto to : g[v]) {
			++inv[to];
			if (!u[to] && inv[to] / 1.0 / in[to] > r) {
				st[++enq] = to, u[to] = 1;
			}
		}
    }

	memset (u, 0, sizeof (u));

	for (int i = 1; i <= enq; ++i)
		u[st[i]] = 1;

	vector <int> ans;

	for (int i = 1; i <= n; ++i)
		if (!u[i])
			ans.push_back (i);

	printf ("%d\n", ans.size ());

	for (auto v : ans)
		printf ("%d ", v);

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const double eps = 1 / 1e7;

const int N = 2e5 + 300;

int n, m, k;
int a[N];
vector <int> g[N];
bool u[N];
int in[N], inv[N];
int stq, enq;
int st[N];

int main () {

	#ifdef LOCAL
	freopen ("in", "r", stdin);
	freopen ("out", "w", stdout);
	#endif

	cin >> n >> m >> k;

	for (int i = 1; i <= k; ++i)
		cin >> a[i];

	for (int i = 1; i <= m; ++i) {
		int x, y;
		cin >> x >> y;
		g[x].push_back (y);
		++in[x];
		g[y].push_back (x);
		++in[y];
	}

	double l = 0, r = 1;

	for (int cnt = 1; cnt <= 50; ++cnt) {
		double mid = (r + l) / 2;
		stq = enq = 0;
		memset (inv, 0, sizeof (inv));
		memset (u, 0, sizeof (u));
		for (int i = 1; i <= k; ++i)
			st[++enq] = a[i];
	    for (int i = 1; i <= k; ++i)
	    	u[a[i]] = 1;
	    while (stq < enq) {
			int v = st[++stq];
			for (auto to : g[v]) {
				++inv[to];
				if (!u[to] && inv[to] / 1.0 / in[to] > mid)
					st[++enq] = to, u[to] = 1;
			}
	    }
	    if (enq < n) {
	    	l = mid;
	    } else {
	    	r = mid;
	    }
	}

	stq = enq = 0;
	memset (inv, 0, sizeof (inv));
	memset (u, 0, sizeof (u));
	for (int i = 1; i <= k; ++i)
		st[++enq] = a[i];
    for (int i = 1; i <= k; ++i)
    	u[a[i]] = 1;
    while (stq < enq) {
		int v = st[++stq];
		for (auto to : g[v]) {
			++inv[to];
			if (!u[to] && inv[to] / 1.0 / in[to] > l)
				st[++enq] = to, u[to] = 1;
		}
    }

	memset (u, 0, sizeof (u));

	for (int i = 1; i <= enq; ++i) {
		u[st[i]] = 1;
	}

	vector <int> ans;

	for (int i = 1; i <= n; ++i)
		if (!u[i])
			ans.push_back (i);

	cout << ans.size () << "\n";

	for (auto v : ans)
		cout << v << " ";

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const double eps = 1 / 1e7;

const int N = 2e5 + 300;

int n, m, k;
int a[N];
vector <int> g[N];
bool u[N];
int in[N], inv[N];
int stq, enq;
int st[N];

int main () {

	#ifdef LOCAL
	freopen ("in", "r", stdin);
	freopen ("out", "w", stdout);
	#endif

	cin >> n >> m >> k;

	for (int i = 1; i <= k; ++i)
		cin >> a[i];

	for (int i = 1; i <= m; ++i) {
		int x, y;
		cin >> x >> y;
		g[x].push_back (y);
		++in[x];
		g[y].push_back (x);
		++in[y];
	}

	double l = 0, r = 1;

	for (int cnt = 1; cnt <= 1; ++cnt) {
		double mid = (r + l) / 2;
		stq = enq = 0;
		memset (inv, 0, sizeof (inv));
		memset (u, 0, sizeof (u));
		for (int i = 1; i <= k; ++i)
			st[++enq] = a[i];
	    for (int i = 1; i <= k; ++i)
	    	u[a[i]] = 1;
	    while (stq < enq) {
			int v = st[++stq];
			for (auto to : g[v]) {
				++inv[to];
				if (!u[to] && inv[to] / 1.0 / in[to] > mid)
					st[++enq] = to, u[to] = 1;
			}
	    }
	    if (enq < n) {
	    	l = mid;
	    } else {
	    	r = mid;
	    }
	}

	stq = enq = 0;
	memset (inv, 0, sizeof (inv));
	memset (u, 0, sizeof (u));
	for (int i = 1; i <= k; ++i)
		st[++enq] = a[i];
    for (int i = 1; i <= k; ++i)
    	u[a[i]] = 1;
    while (stq < enq) {
		int v = st[++stq];
		for (auto to : g[v]) {
			++inv[to];
			if (!u[to] && inv[to] / 1.0 / in[to] > l)
				st[++enq] = to, u[to] = 1;
		}
    }

	memset (u, 0, sizeof (u));

	for (int i = 1; i <= enq; ++i) {
		u[st[i]] = 1;
	}

	vector <int> ans;

	for (int i = 1; i <= n; ++i)
		if (!u[i])
			ans.push_back (i);

	cout << ans.size () << "\n";

	for (auto v : ans)
		cout << v << " ";

	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <queue>
#define next fuck
#define FOR(i,j,k) for(int i=j;i<=k;i++)
using namespace std;
#define MAXN (1000000*3)
int head[MAXN],next[MAXN],e[MAXN],deg[MAXN],cts=1;
void buildside(int a,int b){
	e[cts]=b;
	next[cts]=head[a];
	head[a]=cts++;
	deg[a]++;
}
struct node{
	int cur,ss;
	node(int cur=0,int ss=0):cur(cur),ss(ss)	{}
};
bool operator < (const node& a,const node& b){
	return ((double)a.cur/deg[a.ss])>((double)b.cur/deg[b.ss]);
}
priority_queue <node> q;
int cur[MAXN],save[MAXN],a[MAXN];
bool done[MAXN];
int k;
double gao(int n){
	double maxans=0.0;
	FOR(i,1,n)	q.push(node(cur[i],i));
//	cout<<q.top().ss<<endl;
	while (!q.empty()){
		node now=q.top();q.pop();
	//	cout<<"r "<<now.ss<<" "<<now.cur<<" "<<deg[now.ss]<<" "<<(double)now.cur/deg[now.ss]<<endl;
		if (done[now.ss])	continue;
		maxans=max(maxans,(double)now.cur/deg[now.ss]);
		done[now.ss]=true;
		for(int i=head[now.ss];i>0;i=next[i]){
			cur[e[i]]--;
			q.push(node(cur[e[i]],e[i]));
		}
	}
	return maxans;
}
void re_gao(double ans,int n){
	while (!q.empty())	q.pop();
	FOR(i,1,n)	cur[i]=save[i];
	FOR(i,1,n)	q.push(node(cur[i],i));
	memset(done,false,sizeof done);
	FOR(i,1,k)	done[a[i]]=true;
	int nowr=n;
	while (!q.empty()){
		node now=q.top();q.pop();
		if (done[now.ss])	continue;
//		cout<<(double)now.cur/deg[now.ss]<<endl;
		if ((double)now.cur/deg[now.ss]==ans){
			cout<<nowr-k<<endl;
			FOR(i,1,n)	if (!done[i])	cout<<i<<" ";cout<<endl;
			exit(0);
		}
		done[now.ss]=true;nowr--;
		for(int i=head[now.ss];i>0;i=next[i]){
			cur[e[i]]--;
			q.push(node(cur[e[i]],e[i]));
		}
	}
}
int main (int argc, char *argv[])
{
	std::ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m>>k;
	FOR(i,1,k)	cin>>a[i];
	FOR(i,1,m){
		int a,b;
		cin>>a>>b;
		buildside(a,b);
		buildside(b,a);
	}
	FOR(i,1,n)	cur[i]=deg[i];
	FOR(i,1,k){
		for(int j=head[a[i]];j>0;j=next[j]){
			cur[e[j]]--;
			cur[a[i]]--;
		}
		done[a[i]]=true;
	}
//	FOR(i,1,n)	cout<<cur[i]<<" ";cout<<endl;
	FOR(i,1,n)	save[i]=cur[i];
	double ans=gao(n);
//	cout<<ans<<endl;
	re_gao(ans,n);
	return 0;
}