#include <bits/stdc++.h>
using namespace std;
class nodes {
 public:
  long long id, lev, in_path;
};
void bfs(vector<long long> graph[], vector<nodes> &node, long long dist[],
         long long is_special[], long long n, long long m, long long k) {
  nodes nd;
  long long vert;
  long long vis[n];
  memset(vis, 0, sizeof(vis));
  long long par[n];
  par[0] = -1;
  vis[0] = 1;
  queue<long long> q;
  q.push(0);
  while (!q.empty()) {
    vert = q.front();
    q.pop();
    for (long long nodez : graph[vert]) {
      if (!vis[nodez]) {
        vis[nodez] = 1;
        dist[nodez] = 1 + dist[vert];
        par[nodez] = vert;
        q.push(nodez);
      }
    }
  }
  long long cur = n - 1;
  set<long long> st;
  while (cur != -1) {
    st.insert(cur);
    cur = par[cur];
  }
  for (long long i = 0; i < n; i++) {
    nd.id = i;
    nd.lev = dist[i];
    if (st.find(i) != st.end()) nd.in_path = 1;
    node.push_back(nd);
  }
  return;
}
void bfs1(vector<long long> graph[], long long dist[], long long n, long long m,
          long long k) {
  long long vert;
  long long vis[n];
  memset(vis, 0, sizeof(vis));
  vis[n - 1] = 1;
  queue<long long> q;
  q.push(n - 1);
  while (!q.empty()) {
    vert = q.front();
    q.pop();
    for (long long nodez : graph[vert]) {
      if (!vis[nodez]) {
        vis[nodez] = 1;
        dist[nodez] = 1 + dist[vert];
        q.push(nodez);
      }
    }
  }
  return;
}
bool cmpr(nodes n1, nodes n2) {
  if (n1.lev == n2.lev) return n1.in_path < n2.in_path;
  return n1.lev < n2.lev;
}
int main() {
  long long t;
  t = 1;
  while (t--) {
    long long n, m, k;
    cin >> n >> m >> k;
    long long is_special[n];
    memset(is_special, 0, sizeof(is_special));
    long long u, v;
    for (long long i = 0; i < k; i++) {
      cin >> u;
      u--;
      is_special[u]++;
    }
    vector<long long> graph[n];
    for (long long i = 0; i < m; i++) {
      cin >> u >> v;
      u--, v--;
      graph[u].push_back(v);
      graph[v].push_back(u);
    }
    vector<nodes> node, n1;
    long long dist[n], dist1[n];
    memset(dist, 0, sizeof(dist));
    memset(dist1, 0, sizeof(dist1));
    bfs(graph, node, dist, is_special, n, m, k);
    bfs1(graph, dist1, n, m, k);
    for (long long i = 0; i < node.size(); i++)
      if (is_special[node[i].id]) n1.push_back(node[i]);
    sort(n1.begin(), n1.end(), cmpr);
    long long val;
    long long res = -1;
    for (long long i = 0; i < n1.size() - 1; i++) {
      val = min(dist[n - 1], dist[n1[i].id] + 1 + dist1[n1[i + 1].id]);
      res = max(res, val);
    }
    cout << res << "\n";
  }
  return 0;
}
