#include <bits/stdc++.h>
using namespace std;
const long long int inf = 9e18;
void bfs(vector<vector<long long int>> &g, vector<long long int> &pi,
         vector<long long int> &c, vector<long long int> &dist,
         long long int s) {
  long long int len_g = g.size();
  queue<long long int> q;
  q.push(s);
  c[s] = 1;
  pi[s] = s;
  dist[s] = 0;
  while (!(q.empty())) {
    long long int temp = (q.front());
    q.pop();
    c[temp] = 2;
    long long int len_temp_adj = g[temp].size();
    for (auto i : g[temp]) {
      if (c[i] == 0) {
        dist[i] = dist[temp] + 1;
        q.push(i);
        c[i] = 1;
        pi[i] = temp;
      }
    }
  }
}
int main() {
  long long int n, m, k;
  cin >> n >> m >> k;
  vector<long long int> spe(k);
  ;
  for (long long int i = 0; i < k; i++) cin >> spe[i];
  ;
  for (int i = 0; i <= k - 1; i++) {
    spe[i]--;
  }
  vector<vector<long long int>> G(n);
  for (int i = 0; i <= m - 1; i++) {
    long long int a, b;
    cin >> a >> b;
    a--;
    b--;
    G[b].push_back(a);
    G[a].push_back(b);
  }
  vector<long long int> c(n, 0), pi(n, -1), distfrom1(n, 0), distfromn(n, 0);
  bfs(G, pi, c, distfrom1, 0);
  ;
  for (int i = 0; i < n; i++) c[i] = 0;
  ;
  bfs(G, pi, c, distfromn, n - 1);
  long long int yo = distfromn[0];
  vector<tuple<long long int, long long int, long long int>> imp(k);
  for (int i = 0; i <= k - 1; i++) {
    imp[i] = {distfrom1[spe[i]] - distfromn[spe[i]], distfrom1[spe[i]],
              distfromn[spe[i]]};
  }
  sort(imp.begin(), imp.end());
  vector<long long int> suf(k);
  suf[k - 1] = get<2>(imp[k - 1]);
  for (int i = k - 2; i >= 0; i--) {
    suf[i] = max(suf[i + 1], get<2>(imp[i]));
  }
  long long int ans = -inf;
  for (int i = 0; i <= k - 2; i++) {
    ans = max(get<1>(imp[i]) + suf[i + 1] + 1, ans);
  }
  if (ans > yo) ans = yo;
  cout << ans << "\n";
}
