#include <bits/stdc++.h>
using namespace std;
template <typename... T>
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << "=" << a << ", ";
  err(++it, args...);
}
const long long inf = 1LL << 60;
const long long md = 1000000007;
vector<long long> adj[200005];
long long vis[200005] = {0};
void bfs(long long s) {
  queue<long long> q;
  vis[s] = 1;
  q.push(s);
  while (!q.empty()) {
    long long s = q.front();
    q.pop();
    for (auto i : adj[s]) {
      if (vis[i]) continue;
      vis[i] = vis[s] + 1;
      q.push(i);
    }
  }
}
long long vis2[200005] = {0};
void bfs2(long long s) {
  queue<long long> q;
  vis2[s] = 1;
  q.push(s);
  while (!q.empty()) {
    long long s = q.front();
    q.pop();
    for (auto i : adj[s]) {
      if (vis2[i]) continue;
      vis2[i] = vis2[s] + 1;
      q.push(i);
    }
  }
}
bool comp(pair<long long, long long> a, pair<long long, long long> b) {
  return a.first - a.second < b.first - b.second;
}
void solve() {
  long long n, m, k;
  cin >> n >> m >> k;
  long long a[k];
  for (long long i = 0; i < k; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  bfs(1);
  bfs2(n);
  pair<long long, long long> d[k];
  for (long long i = 0; i < k; i++) {
    d[i] = {vis[a[i]], vis2[a[i]]};
  }
  sort(d, d + k, comp);
  long long ans = 0;
  long long mx = -inf;
  for (long long i = 0; i < k; i++) {
    ans = max(ans, mx + d[i].second);
    mx = max(mx, d[i].first);
  }
  cout << min(vis[n] - 1, ans - 1);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  for (long long i = 1; i <= t; i++) {
    solve();
    cout << '\n';
  }
}
