#include <bits/stdc++.h>
using namespace std;
int dis[200010][4];
int a[200010];
int n, m, k;
vector<vector<int> > v;
void bfs(int u, int g) {
  dis[u][g] = 1;
  queue<int> q;
  q.push(u);
  while (!q.empty()) {
    int f = q.front();
    q.pop();
    for (int i = 0; i < v[f].size(); i++) {
      int d = v[f][i];
      if (!dis[d][g]) {
        q.push(d);
        dis[d][g] = dis[f][g] + 1;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  v.resize(2 * m + 10);
  for (int i = 1; i <= k; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  bfs(n, 0);
  bfs(1, 1);
  vector<pair<int, int> > res;
  for (int i = 1; i <= k; i++) {
    res.push_back(make_pair(dis[a[i]][0], a[i]));
  }
  int mn = 1e9, mnX = 1e9, x = 0, y = 0;
  sort(res.begin(), res.end());
  int mx = 0;
  for (int i = 1; i < res.size(); i++) {
    mn = abs(res[i].first - res[i - 1].first);
    x = res[i].second;
    y = res[i - 1].second;
    mx = min(dis[1][0] - 1, max(mx, dis[x][1] + dis[y][0] - 1));
  }
  cout << mx;
  return 0;
}
