#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
int n, m, k;
int flag[maxn];
vector<int> edge[maxn];
int dis1[maxn];
int dis2[maxn];
void bfs(int x, int dis[]) {
  queue<int> Q;
  Q.push(x);
  dis[x] = 0;
  while (!Q.empty()) {
    int now = Q.front();
    Q.pop();
    for (int i = 0; i < edge[now].size(); i++) {
      if (edge[now][i] != x && dis[edge[now][i]] == 0) {
        dis[edge[now][i]] = dis[now] + 1;
        Q.push(edge[now][i]);
      }
    }
  }
}
struct node {
  int x, id;
} now;
vector<node> a, b;
bool cmp(const node& a, const node& b) { return a.x < b.x; }
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int tmp, i = 1; i <= k; i++) {
    scanf("%d", &tmp);
    flag[tmp] = 1;
  }
  for (int u, v, i = 1; i <= m; i++) {
    scanf("%d %d", &u, &v);
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  bfs(1, dis1);
  bfs(n, dis2);
  for (int i = 1; i <= n; i++) {
    if (flag[i]) {
      now.x = dis1[i];
      now.id = i;
      a.push_back(now);
    }
  }
  sort(a.begin(), a.end(), cmp);
  for (int i = 1; i <= n; i++) {
    if (flag[i]) {
      now.x = dis2[i];
      now.id = i;
      b.push_back(now);
    }
  }
  sort(b.begin(), b.end(), cmp);
  int maxs = -0x3f3f3f3f;
  int best = 0;
  for (int i = 0; i < a.size(); i++) {
    int p = a[i].id;
    best = max(best, maxs + dis2[p]);
    maxs = max(maxs, dis1[p]);
  }
  cout << min(dis1[n], best + 1) << endl;
}
