#include <bits/stdc++.h>
using namespace std;
long long INF = 1e9;
const long long mod = 1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
vector<vector<int> > g;
vector<int> vis;
vector<int> d;
vector<int> path;
void bfs(int index) {
  queue<int> q;
  q.push(index);
  d[index] = 0;
  vis[index] = 1;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (auto i : g[x]) {
      if (vis[i] == 0) {
        vis[i] = 1;
        d[i] = 1 + d[x];
        path[i] = x;
        q.push(i);
      }
    }
  }
}
void solve() {
  int n, m, k, x, y, z, res = INT_MIN;
  cin >> n >> m >> k;
  vector<int> a(k);
  d = vector<int>(n, 0);
  vis = vector<int>(n);
  path = vector<int>(n);
  g = vector<vector<int> >(n);
  unordered_map<int, int> mp;
  for (long long i = 0; i < k; i++) cin >> a[i];
  for (long long i = 0; i < m; i++) {
    cin >> x >> y;
    x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  bfs(0);
  vector<int> d1 = d;
  d = vector<int>(n);
  vis = vector<int>(n);
  bfs(n - 1);
  sort(a.begin(), a.end(), [&](int x, int y) { return d1[x - 1] < d1[y - 1]; });
  int ans = 0;
  for (int i = 0; i + 1 < k; i++)
    ans = max(ans, d1[a[i] - 1] + 1 + d[a[i + 1] - 1]);
  std::cout << min(ans, d1[n - 1]) << '\n';
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
