#include <bits/stdc++.h>
using namespace std;
const int inf=1e9;
int n, m, k, x, y;
int dist[17][100001];
int dp[17][131072];
int c[17];
int solve(int last, int mask) {
	if (__builtin_popcount(mask)==1) return 0;
	if (dp[last][mask]!=0) return dp[last][mask];
	int ans=inf;
	for (int i=0; i<k; i++) {
		if (i!=last && mask&(1<<i)) {
			int t=solve(i, mask^(1<<last));
			ans=min(ans, t+dist[last][c[i]]);
		}
	}
	return dp[last][mask]=ans;
}
int main() {
	cin>>n>>m;
	vector<int> v[n+1];
	for (int i=0; i<m; i++) {
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	cin>>k;
	for (int i=0; i<k; i++) cin>>c[i];
	for (int i=0; i<k; i++) {
		for (int j=1; j<=n; j++) dist[i][j]=inf;
		queue<int> q;
		q.push(c[i]);
		dist[i][c[i]]=0;
		while (!q.empty()) {
			int temp=q.front();
			q.pop();
			int size=v[temp].size();
			for (int j=0; j<size; j++) {
				if (dist[i][v[temp][j]]==inf) {
					q.push(v[temp][j]);
					dist[i][v[temp][j]]=dist[i][temp]+1;
				}
			}
		}
	}
	for (int i=1; i<k; i++) {
		if (dist[0][c[i]]==inf) {
			cout<<"-1\n";
			return 0;
		}
	}
	int ans=inf;
	for (int i=0; i<k; i++) {
		ans=min(ans, solve(i, (1<<k)-1));
	}
	cout<<ans+1<<'\n';
}
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VVI vector<VI>
#define VL vector<LL>
#define VVL vector<VL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define all(x) x.begin(),x.end()
#define watch(x) cout<<(#x)<<" = "<<(x)<<'\n'
#define mset(a,v) memset(a,v,sizeof(a))
#define setp(x) cout<<fixed<<setprecision(x)
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e5 + 100;
const LL MX1 = 20;
const LL INF = 1e9;

VI g[MX], mem[MX1];
int k, c[MX1], d[MX1][MX1];

void dp(int i, int v)
{
    if(v + 1 == (1 << k))
    {
        mem[i][v] = 0;
        return;
    }

    int v1;

    mem[i][v] = INF;

    loop(j,0,k)
    {
        if(!(v & (1 << j)))
        {
            v1 = v | (1 << j);
            if(mem[j][v1] == -1) dp(j,v1);

            mem[i][v] = min(mem[i][v], mem[j][v1] + d[i][j]);
        }
    }
}

bool bfs(int s, int id)
{
    queue<int> q;
    int dis[MX];
    mset(dis,-1);

    dis[s] = 0;
    q.push(s);

    while(!q.empty())
    {
        int u = q.front();
        q.pop();

        for(int v : g[u])
        {
            if(dis[v] == -1)
            {
                dis[v] = 1 + dis[u];
                q.push(v);
            }
        }
    }

    loop(i,0,k)
    {
        if(dis[c[i]] == -1) return false;
        d[id][i] = dis[c[i]];
    }

    return true;
}

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int n, m, u, v;
    cin>>n>>m;

    loop(i,0,m)
    {
        cin>>u>>v;
        --u; --v;

        g[u].PB(v);
        g[v].PB(u);
    }

    cin>>k;
    loop(i,0,k) {cin>>c[i]; --c[i]; mem[i].resize(1 << (k+1), -1);}

    int f = 1;

    loop(i,0,k)
    {
        if(!bfs(c[i], i)) {f = 0; break;}
    }

    int ans = -1;

    if(f)
    {
        int v;
        ans = INF;

        loop(i,0,k)
        {
            v = (1 << i);
            if(mem[i][v] == -1) dp(i,v);

            ans = min(ans, 1 + mem[i][v]);
        }
    }

    cout<<ans<<'\n';

    return 0;
}
