#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int, int> >
#define vpll vector <pair <long long, long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define vb vector <bool>
#define vvb vector <vb>
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MANX MAXN
#define itn int
#define dbg(x); {cout << #x << "=" << x << ", ";}
#define in(x); { for (auto &to : x) cin >> to;}
#define out(x); { for (auto &to : x) cout << to << " "; cout << '\n'; }

const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const int mod1 = 1e9+7;
const int mod2 = 1e9+21;

void solve()
{
    int n,m;
    cin>>n>>m;
    vvi g(n);
    while (m--){
        int u,v;
        cin>>u>>v;
        u--,v--;
        g[u].pb(v);
        g[v].pb(u);
    }
    int k;
    cin>>k;
    if (k==1){
        cout<<1<<'\n';
        return;
    }
    vector <vector <int> > dist(k);
    vector <int> c(k);
    rep(i,k)
        cin>>c[i],c[i]--;
    for (int i=0;i<k;i++){
        vector <int> d(n,INF);
        d[c[i]]=0;
        queue<int> q;
        q.push(c[i]);
        while (!q.empty())
        {
            int f=q.front();
            q.pop();
            for (auto to:g[f])
            {
                if (d[to]!=INF)
                    continue;
                d[to]=d[f]+1;
                q.push(to);
            }
        }
        swap(dist[i],d);
    }
    vector <vi> dp((1<<k),vi(k,INF));
    for (int i=0;i<k;i++)
        dp[(1<<i)][i]=1;
    for (int i=0;i<k-1;i++)
    {
        for (int mask=(1<<k)-1;mask>=0;mask--)
        {
            for (int was=0;was<k;was++)
            {
                if (dp[mask][was]==INF)
                    continue;
                for (int j=0;j<k;j++)
                {
                    dp[mask|(1<<j)][j]=min(dp[mask|(1<<j)][j],dp[mask][was]+dist[was][c[j]]);
                }
            }
        }
    }
    int ans=INF;
    for (int i=0;i<k;i++)
        ans=min(ans,dp[(1<<k)-1][i]);
    cout<<(ans==INF?-1:ans)<<'\n';
}

int main() {
    #ifdef Mip182
    freopen("a.in", "r", stdin);
    #else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #endif
    int _t;
    _t=1;
//    cin>>_t;
    while (_t--)
        solve();
    #ifdef Mip182
    cout<<'\n'<<"Time : "<<(double)(clock())/CLOCKS_PER_SEC<<'\n';
    #endif
}

#include<bits/stdc++.h>
using namespace std;
#define pb emplace_back
#define st first
#define nd second
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii; 
typedef vector<vi> vvi;  
#define sz(a) int((a).size()) 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>b;i--)
#define endl "\n"
#define fre freopen("in.txt","r",stdin);freopen("out.txt","w",stdout)
#define start ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define N 200005

//2 4 4 +1
// 


ll yen[20][1<<20];
queue<pair<int,int>> q;
vector<int> v[N];
ll vis[N];
ll dp[20][20];
ll k;
int idx[N];
vector<int> c;
ll sum=0;
bool check=true;


void solve()
{
int n,m;
cin>>n>>m;


rep(i,0,m)
{
	int a,b;
	cin>>a>>b;
	v[a].pb(b);v[b].pb(a);
}

cin>>k;
memset(idx,-1,sizeof(idx));
rep(i,0,k)
{
	int a;
	cin>>a;
	c.pb(a);
	idx[c[i]]=i;
}



rep(i,0,k)
{
	memset(vis,0,sizeof(vis));
	q.push(make_pair(c[i],0));

	rep(j,0,k)
	{
		dp[i][j]=N;
	}
	while(!q.empty())
	{
		ll temp=q.front().st;
		ll cur=q.front().nd;
		q.pop();
		if(vis[temp])
			continue;
		vis[temp]=1;
		if(idx[temp] != -1) dp[i][idx[temp]] = cur;
		rep(j,0,v[temp].size())
		{
			if(vis[v[temp][j]])
				continue;
			q.push({v[temp][j],cur+1});
		}
	}
}

memset(yen, N, sizeof(yen));
    for (int i=0; i<k; i++) yen[i][1<<i] = 0;
    
    for (int j=0; j<(1<<k); j++) {
        for (int i=0; i<k; i++) if (j & (1<<i)) {
            int cur = j & ~(1<<i);
            for (int l=0; l<k; l++) if (cur & (1<<l)) {
                yen[i][j] = min(yen[i][j], yen[l][cur] + dp[l][i]);
            }
        }
    }

    ll ans = N;
    for (int i=0; i<k; i++) ans = min(ans, yen[i][(1<<k)-1]);

    if (ans == N) cout<<-1<<endl;
    else cout<<ans+1<<endl;

}

int main(){
	start
	
	int t=1;
	//cin>>t;
	rep(i,0,t)
	solve();
}