#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
queue<int> q;
int n, m, k, a[maxn], d1[maxn], dn[maxn], max1, ans;
bool sp[maxn], mark[maxn];
vector<pair<int, int> > vec;
vector<int> G[maxn];
void bfs1() {
  mark[1] = 1;
  d1[1] = 0;
  if (sp[1]) vec.push_back({0, 1});
  q.push(1);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < G[u].size(); i++) {
      int v = G[u][i];
      if (mark[v]) continue;
      q.push(v);
      mark[v] = 1;
      d1[v] = d1[u] + 1;
      if (sp[v]) vec.push_back({d1[v], v});
    }
  }
  return;
}
void bfsn() {
  fill(mark, mark + maxn, 0);
  mark[n] = 1;
  dn[n] = 0;
  q.push(n);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < G[u].size(); i++) {
      int v = G[u][i];
      if (mark[v]) continue;
      q.push(v);
      mark[v] = 1;
      dn[v] = dn[u] + 1;
    }
  }
  return;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < k; i++) {
    int u;
    cin >> u;
    sp[u] = 1;
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  bfs1();
  bfsn();
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  for (int i = 0; i < k; i++) {
    int u = vec[i].second;
    if (i > 0) ans = max(ans, d1[u] + max1 + 1);
    max1 = max(max1, dn[u]);
  }
  cout << min(dn[1], ans) << endl;
}
