#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define fi first
#define se second
#define UP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define UU(a,b,c) for(ll (a)=(b);(a)<=(c);(a)++)
#define DN(a,b,c) for(ll (a)=(b);(a)>(c);(a)--)
#define DU(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)

ll n, k, c[18], u, v, m;
vector<int> edge[100005];
int bitOf[100005];
ll DP[(1LL << 17)][18];

void reset()
{
	UP(i, 0, 1LL << 17)
	{
		UP(j, 0, 17)
		{
			DP[i][j] = -1;
		}
	}
}

void input()
{
	cin >> n >> m;
	UU(i, 1, m)
	{
		cin >> u >> v;
		edge[u].pb(v);
		edge[v].pb(u);
	}
	cin >> k;
	UP(i, 0, k)
	{
		cin >> u;
		c[i] = u;
		bitOf[u] = (1LL << i);
	}
}

class Compare
{
public:
    bool operator() (pair<int, pii> a, pair<int, pii> b)
    {
    	if(a.fi == b.fi)
    	{
    		return __builtin_popcount(a.se.se) < __builtin_popcount(b.se.se);
    	}
    	return a.fi > b.fi;
    }
};

bool vis[100005] = {0};
ll dist[20][20];

ll bfs(int now, int target)
{
	bool vis[100005] = {0};
	queue<int> q;
	q.push(now);
	for(int step = 0 ; !q.empty() ; step++)
	{
		int csz = q.size();
		while(csz--)
		{
			int now = q.front();
			q.pop();
			vis[now] = true;
			if(now == target)
			{
				return step;
			}
			UP(i, 0, edge[now].size())
			{
				if(vis[edge[now][i]] == false)
				{
					q.push(edge[now][i]);
					vis[edge[now][i]] = true;
				}
			}
		}
	}
	return INT_MAX;
}

ll dp(int now, int bit)
{
	if(__builtin_popcount(bit) == k)
	{
		return 1;
	}
	else if(DP[bit][now] != -1) return DP[bit][now];
	else
	{
		ll cost = INT_MAX;

		UP(i, 0, k)
		{
			if(bit & (1LL << i)){}
			else
			{
				cost = min(cost, dist[now][i] + dp(i, (bit | (1LL << i))));
			}
		}
		cost = min(cost, (ll)INT_MAX);
		return DP[bit][now] = cost;
	}
}

void solve()
{
	UU(j, 0, k)
	{
		UU(i, 0, k) dist[i][j] = INT_MAX;
	}

	UP(j, 0, k)
	{
		UP(i, j + 1, k)
		{
			dist[j][i] = dist[i][j] = bfs(c[i], c[j]);
		}
	}

	ll ans = INT_MAX;
	UP(i, 0, k)
	{
		ans = min(ans, dp(i, (1LL << i)));
	}
	if(ans == INT_MAX) ans = -1;
	cout << ans << endl;
}

void LetsRock()
{
	solve();
}

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

		reset();
		input();
		LetsRock();
	return 0;
}


#include<bits/stdc++.h>
using namespace std ;
const long long INF =1001001001 ; 
//巡回セールスマン問題
//要解き直し

int main(){
    int N , M ; 
    cin >> N >> M ; 
    vector<vector<int > > to(N) ;  
    for(int i = 0 ; i < M ; i++){
      int a , b ; 
      cin >> a >> b ; 
      a-- ; 
      b-- ; 
      to.at(a).push_back(b) ;
      to.at(b).push_back(a) ;  
    }

    int K ; 
    cin >> K ; 
    vector<int > C(K) ; 
    for(int i = 0 ; i < K ; i ++){
        cin >> C.at(i) ;
        C.at(i)-- ; 
    }

    vector<vector<int > > dist(K , vector<int >(K)) ; //dist.at(i).at(j) = distance of i - j 

    auto bfs = [&](int sv){
      vector<int > dist(N , INF) ; 
      queue<int > q ; 
      dist.at(sv) = 0 ; 
      q.push(sv) ;
      while(!q.empty()){
        int v = q.front() ; 
        q.pop() ;

        for(int u : to.at(v)){
          if(dist.at(u) != INF) continue ;
          dist.at(u) = dist.at(v) + 1 ; 
          q.push(u) ; 
        }
      }
      return dist ; 
    } ; 

    for(int i = 0 ; i < K ; i++){
      vector<int> d = bfs(C.at(i)) ;
      for(int j = 0 ; j < K ; j++){
        dist.at(i).at(j) = d.at(C.at(j)) ;
      }
    }

    int k2 = 1<<K ; 
    vector<vector<int > > dp(k2 , vector<int > (K,INF));

    for(int i = 0 ; i < K ; i++){
      dp.at(1<<i).at(i) = 1 ; 
    }

    for(int s = 0 ; s < k2 ; s++){
      for(int i = 0 ; i < K ; i++){
        if(!(s>>i&1)) continue ;
        for(int j = 0 ; j < K ; j++){
          if(s>>j&1) continue ;
          dp.at(s|1<<j).at(j) = min(dp.at(s|1<<j).at(j) , dp.at(s).at(i) + dist.at(i).at(j)) ;
        } 
      }
    }

    int ans = INF ; 
    for(int i = 0 ; i < K ; i++){
      ans = min(ans , dp.at(k2-1).at(i)) ; 
    }

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



}