#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long po(long long x, long long n) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) ans = (ans * x) % mod;
    x = (x * x) % mod;
    n /= 2;
  }
  return ans;
}
vector<vector<long long> > g;
vector<long long> dz, de;
vector<long long> vis;
void bfs1() {
  queue<long long> q;
  long long y;
  q.push(1);
  dz[1] = 0;
  vis[1] = 1;
  while (!q.empty()) {
    y = q.front();
    q.pop();
    for (auto h = g[y].begin(); h != g[y].end(); h++) {
      if (!vis[*h]) {
        vis[*h] = 1;
        q.push(*h);
        dz[*h] = dz[y] + 1;
      }
    }
  }
}
void bfs2(long long n) {
  queue<long long> q;
  long long y;
  q.push(n);
  de[n] = 0;
  vis[n] = 1;
  while (!q.empty()) {
    y = q.front();
    q.pop();
    for (auto h = g[y].begin(); h != g[y].end(); h++) {
      if (!vis[*h]) {
        vis[*h] = 1;
        q.push(*h);
        de[*h] = de[y] + 1;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) {
    long long n, m, k;
    cin >> n >> m >> k;
    set<long long> s;
    int f = 0;
    long long x, y;
    for (int i = 0; i < k; i++) {
      cin >> x;
      s.insert(x);
    }
    g.assign(n + 1, vector<long long>());
    dz.assign(n + 1, 0);
    de.assign(n + 1, 0);
    vis.assign(n + 1, 0);
    for (int i = 0; i < m; i++) {
      cin >> x >> y;
      if (s.find(x) != s.end() && s.find(y) != s.end()) f = 1;
      g[x].push_back(y);
      g[y].push_back(x);
    }
    bfs1();
    for (int i = 0; i < n + 1; i++) vis[i] = 0;
    bfs2(n);
    if (f)
      cout << dz[n] << "\n";
    else {
      long long mn = dz[n];
      vector<pair<long long, long long> > d1;
      for (auto h = s.begin(); h != s.end(); h++) {
        d1.push_back(make_pair(dz[*h] - de[*h], *h));
      }
      sort(d1.begin(), d1.end());
      long long mx = de[d1[k - 1].second], sm = 0;
      for (int i = k - 2; i >= 0; i--) {
        sm = max(sm, mx + dz[d1[i].second]);
        if (de[d1[i].second] > mx) mx = de[d1[i].second];
      }
      sm++;
      cout << min(mn, sm) << "\n";
    }
  }
  return 0;
}
