#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
const ll MOD = 1e9 + 7, N = 2e5 + 10;
vector<ll> g[N];
ll vis[N];
ll n, m, k;
void bfs(ll s, vector<ll> &dist) {
  for (ll i = 1; i < n + 1; i++) {
    vis[i] = 0;
  }
  dist[s] = 0;
  queue<pii> q;
  q.push({s, 0});
  while (!q.empty()) {
    ll nd = q.front().first, st = q.front().second;
    q.pop();
    if (vis[nd]) continue;
    vis[nd] = 1;
    dist[nd] = min(dist[nd], st);
    for (auto &v : g[nd]) {
      q.push({v, st + 1});
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  vector<ll> spec;
  spec.assign(k, 0);
  for (ll i = 0; i < k; i++) {
    cin >> spec[i];
  }
  ll u, v;
  for (ll i = 0; i < m; i++) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  vector<ll> dist_src(n + 2, INT_MAX), dist_dest(n + 2, INT_MAX);
  bfs(1, dist_src);
  bfs(n, dist_dest);
  vector<pii> tmp;
  for (auto &i : spec) {
    tmp.push_back({dist_dest[i] - dist_src[i], i});
  }
  sort(tmp.begin(), tmp.end());
  ll ans = 0;
  for (ll i = 1; i < k; i++) {
    ll a = tmp[i - 1].second, b = tmp[i].second;
    ll path =
        min(dist_src[a] + dist_dest[b] + 1, dist_src[b] + dist_dest[a] + 1);
    if (path >= dist_src[n]) {
      cout << dist_src[n] << '\n';
      return 0;
    }
    ans = max(ans, path);
  }
  cout << ans << '\n';
  return 0;
}
