#include <bits/stdc++.h>
using namespace std;
int n, m, k;
vector<int> E[200020], V;
int dis[2][200020];
void solve() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= k; i++) {
    int x;
    scanf("%d", &x);
    V.push_back(x);
  }
  for (int i = 0; i < (m); i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    E[x].push_back(y);
    E[y].push_back(x);
  }
  for (int v = 0; v < (2); v++) {
    int st = (v == 0 ? 1 : n);
    vector<int> q;
    auto D = dis[v];
    for (int i = 1; i <= n; i++) D[i] = -1;
    D[st] = 0;
    q.push_back(st);
    for (int i = 0; i < ((int)(q).size()); i++) {
      int t = q[i];
      for (int e : E[t])
        if (D[e] == -1) {
          D[e] = D[t] + 1;
          q.push_back(e);
        }
    }
  }
  sort((V).begin(), (V).end(),
       [&](int x, int y) { return dis[0][x] > dis[0][y]; });
  int mx = -1e9, ans = 0;
  for (int i = 0; i + 1 < (int)(V).size(); i++) {
    if (dis[0][V[i]] == dis[0][V[i + 1]]) {
      printf("%d\n", dis[0][n]);
      return;
    }
  }
  for (int i = 0; i < ((int)(V).size()); i++) {
    int u = V[i];
    int val = min({dis[0][n], dis[0][u] + dis[1][u], dis[0][u] + 1 + mx});
    ans = max(ans, val);
    mx = max(mx, dis[1][u]);
  }
  printf("%d\n", ans);
}
int main() {
  int T = 1;
  for (int t = 1; t <= T; t++) {
    solve();
  }
  return 0;
}
