#include <bits/stdc++.h>
using namespace std;
int a[200005];
vector<int> G[200005];
int dis1[200005];
int dis2[200005];
int vis[200005];
void bfs(int s, int dis[]) {
  memset(vis, 0, sizeof(vis));
  queue<int> Q;
  Q.push(s);
  vis[s] = 1;
  while (!Q.empty()) {
    int fr = Q.front();
    Q.pop();
    for (auto v : G[fr]) {
      if (vis[v]) continue;
      vis[v] = 1;
      dis[v] = dis[fr] + 1;
      Q.push(v);
    }
  }
}
struct node {
  int x, y;
  bool operator<(const node& b) const { return x - y < b.x - b.y; }
} p[200005];
int suf[200005];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= k; i++) scanf("%d", &a[i]);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  bfs(1, dis1);
  bfs(n, dis2);
  for (int i = 1; i <= k; i++) {
    p[i] = {dis1[a[i]], dis2[a[i]]};
  }
  sort(p + 1, p + 1 + k);
  for (int i = k; i >= 1; i--) {
    suf[i] = max(suf[i + 1], p[i].y);
  }
  int ans = 0;
  for (int i = 1; i < k; i++) {
    ans = max(ans, p[i].x + suf[i + 1]);
  }
  ans = min(ans + 1, dis1[n]);
  cout << ans;
  return 0;
}
