#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int dist[3][200005];
int vis[3][200005];
vector<int> adj[200005];
int special[200005];
void bfs(bool b, int node) {
  dist[b][node] = 0;
  vis[b][node] = 1;
  queue<int> q;
  q.push(node);
  while (q.size()) {
    int curr = q.front();
    q.pop();
    for (auto e : adj[curr]) {
      if (!vis[b][e]) {
        dist[b][e] = dist[b][curr] + 1;
        vis[b][e] = 1;
        q.push(e);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m >> k;
  for (int i = 0; i < k; i++) cin >> special[i];
  while (m--) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  bfs(0, 1);
  bfs(1, n);
  vector<pair<int, int> > toHere;
  vector<pair<int, int> > endd;
  for (int i = 0; i < k; i++) {
    toHere.push_back({dist[0][special[i]], special[i]});
  }
  sort(toHere.begin(), toHere.end());
  sort(endd.begin(), endd.end());
  int maxi = 0;
  for (int i = 1; i < toHere.size(); i++) {
    maxi = max(maxi, 1 + toHere[i - 1].first + dist[1][toHere[i].second]);
  }
  cout << min(maxi, dist[0][n]);
  return 0;
}
