#include <bits/stdc++.h>
using namespace std;
int dis1[351500], disn[351500];
vector<int> e[351500 * 2];
void add(int u, int v) { e[u].push_back(v); }
int a[351500];
queue<int> q;
void bfs(int st, int dis[]) {
  while (!q.empty()) q.pop();
  q.push(st);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < e[u].size(); i++) {
      int v = e[u][i];
      if (v != st && dis[v] == 0) {
        dis[v] = dis[u] + 1;
        q.push(v);
      }
    }
  }
}
bool cmp(int x, int y) { return dis1[x] - disn[x] < dis1[y] - disn[y]; }
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 = 1; i <= m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    add(u, v);
    add(v, u);
  }
  bfs(1, dis1);
  bfs(n, disn);
  sort(a + 1, a + 1 + k, cmp);
  int ans = 0, x = dis1[a[1]];
  for (int i = 2; i <= k; i++) {
    ans = max(ans, x + 1 + disn[a[i]]);
    x = max(x, dis1[a[i]]);
  }
  printf("%d\n", min(dis1[n], ans));
}
