#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
const int MAX = 2e5 + 10;
int n, m, k;
int a[MAX], f[MAX], g[MAX], mf[MAX], mg[MAX];
vi es[MAX];
void bfs(int s, int *f) {
  memset(f, -1, sizeof(int) * MAX);
  queue<int> qe;
  qe.push(s);
  f[s] = 0;
  while (!qe.empty()) {
    int u = qe.front();
    qe.pop();
    for (auto v : es[u])
      if (f[v] == -1) {
        f[v] = f[u] + 1;
        qe.push(v);
      }
  }
}
void process() {
  cin >> n >> m >> k;
  for (int i = 1; i <= k; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    es[u].push_back(v);
    es[v].push_back(u);
  }
  bfs(1, f);
  bfs(n, g);
  int res = 0;
  sort(a + 1, a + k + 1, [](int x, int y) {
    return f[x] < f[y] || (f[x] == f[y] && g[x] < g[y]);
  });
  for (int i = k; i >= 1; i--) mg[i] = max(mg[i + 1], g[a[i]]);
  for (int i = 1; i < k; i++) {
    res = max(res, min(f[a[i]] + mg[i + 1] + 1, f[n]));
  }
  sort(a + 1, a + k + 1, [](int x, int y) {
    return g[x] < g[y] || (g[x] == g[y] && f[x] < f[y]);
  });
  for (int i = k; i >= 1; i--) mf[i] = max(mf[i + 1], f[a[i]]);
  for (int i = 1; i < k; i++) {
    res = max(res, min(g[a[i]] + mf[i + 1] + 1, f[n]));
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  process();
}
