#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
int a[103];
int f[103][103];
signed main()
{
	int n=read(),x=read();
	int M=0;
	for(int i=1; i<=n; i++) a[i]=read(),M=max(M,a[i]);
	int ans=x-M;
	for(int i=2; i<=n; i++)
	{
		//use i elements
		int t=x%i;
		//the goal
		memset(f,-1,sizeof(f));
		f[0][0]=0;
		for(int j=1; j<=n; j++)
		{
			int g=a[j]%i;
			for(int A=j; A>=1; A--)
			for(int k=0; k<i; k++) if(f[A-1][k]!=-1)
			{
				f[A][(k+g)%i]=max(f[A][(k+g)%i],f[A-1][k]+a[j]);
			}
		}
		if(f[i][t]!=-1) ans=min(ans,(x-f[i][t])/i);
	}
	printf("%lld\n",ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
// #define int long long 
typedef pair<int, int> pii; 
#define ll long long
#define ar array
const int mxN=1e5+1;
const int mod=1e9+7;
const ll INF=1e18;
#define what_is(x) cerr << #x << " is " << x << endl;
vector<int> adj[mxN];
ll dp[(1<<18)][18];
ll d[19][mxN];
ll c[19];
int n,m;
void bfs(int cur,int src){
	for(int i=0;i<=n;i++){
		d[cur][i]=INF;
	}
	d[cur][src]=0;
	queue<int> q;
	q.push(src);
	while(!q.empty()){
		int u=q.front();
		q.pop();
		for(int v:adj[u]){
			if(d[cur][v] == INF){
				d[cur][v]=d[cur][u]+1;
				q.push(v);
			}
		}
	}
}
void solve(){
	
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;--x,--y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	int k; cin>>k;
	for(int i=0;i<k;i++){
		cin>>c[i]; c[i]--;
		bfs(i,c[i]);
	}


	for(int mask=1;mask<(1<<k);mask++){
		// initialize mask 
		if(__builtin_popcount(mask)==1){
			for(int i=0;i<k;i++){
				if((1<<i)&mask){
					dp[mask][i]=1;
				}else{
					dp[mask][i]=INF;
				}
			}
			continue;
		}
			
		for(int i=0;i<k;i++){
			// i is my left edge which I want to add
			dp[mask][i]=INF;
			if(mask&(1<<i)){
				// pick all other active bit in mask except i  (mask^(1<<i))
				for(int j=0;j<k;j++){
					if((1<<j)&(mask^(1<<i))){
						dp[mask][i]=min(dp[mask][i],dp[mask^(1<<i)][j]+d[i][c[j]]);
					}
				}	
			}
		}
	}
	
	ll ans=INF;
	for(int i=0;i<k;i++){
		ans=min(ans,dp[(1<<k)-1][i]);
	}
	if(ans==INF){
		ans=-1;
	}
	cout<<ans<<endl;

}

signed main() {
	#ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout<<setprecision(12)<<fixed;
   
    int t=1;
    // cin>>t;
    while(t--)
    	solve();
	return 0;
   
}  