#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 50;
const int INF = 0x3f3f3f3f;
int dis[2][maxn], a[maxn], vis[maxn];
vector<int> G[maxn];
int n, m, k;
void BFS(int x, int v) {
  for (int i = 1; i <= n; i++) {
    dis[x][i] = INF;
    vis[i] = 0;
  }
  queue<int> q;
  dis[x][v] = 0;
  vis[v] = 1;
  q.push(v);
  while (!q.empty()) {
    int now = q.front();
    q.pop();
    for (auto u : G[now]) {
      if (vis[u]) {
        continue;
      }
      dis[x][u] = dis[x][now] + 1;
      q.push(u);
      vis[u] = 1;
    }
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (int i = 0; i < k; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  BFS(0, 1);
  BFS(1, n);
  int ans = 0;
  vector<pair<int, int> > v;
  for (int i = 0; i < k; i++) {
    v.push_back({dis[0][a[i]] - dis[1][a[i]], a[i]});
  }
  sort(v.begin(), v.end());
  int ax = 0;
  for (int i = 0; i < k; i++) {
    if (i) {
      ans = max(ans, ax + dis[1][v[i].second] + 1);
    }
    ax = max(ax, dis[0][v[i].second]);
  }
  cout << min(ans, dis[0][n]) << endl;
  return 0;
}
