#include <bits/stdc++.h>
using namespace std;
long long INV2 = 500000004;
long long INV6 = 166666668;
long long power(long long a, long long b, long long c) {
  long long x = 1, y = a;
  while (b > 0) {
    if (b & 1) x = (x * y) % c;
    y = (y * y) % c;
    b /= 2;
  }
  return x % c;
}
int dx[] = {0, -1, 0, 1};
int dy[] = {-1, 0, 1, 0};
const int MAX = 1005;
long long c[MAX];
vector<int> v[MAX];
long long nse, nsv;
bool sp[MAX], vis[MAX], flag;
void dfs(int i) {
  nsv++;
  vis[i] = 1;
  if (sp[i]) {
    flag = 1;
  }
  for (int j = 0; j < v[i].size(); ++j) {
    nse++;
    int idx = v[i][j];
    if (!vis[idx]) {
      dfs(idx);
    }
  }
  return;
}
vector<pair<long long, pair<long long, long long> > > vp;
int main() {
  long long n, m, k;
  scanf("%lld%lld%lld", &n, &m, &k);
  for (int i = 1; i <= k; ++i) {
    scanf("%lld", &c[i]);
    sp[c[i]] = 1;
  }
  int x, y;
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  long long ed_ns = 0, ve_ns = 0;
  for (int i = 1; i <= n; ++i) {
    if (!vis[i]) {
      nse = 0, nsv = 0, flag = 0;
      dfs(i);
      nse /= 2;
      if (!flag) {
        ed_ns += nse;
        ve_ns += nsv;
      } else {
        long long ce = (nsv * (nsv - 1)) / 2LL;
        ce -= nse;
        vp.push_back(make_pair(nse, make_pair(nsv, ce)));
      }
    }
  }
  long long tot_ns = (ve_ns * (ve_ns - 1)) / 2LL;
  tot_ns -= ed_ns;
  long long ans = -1, ed = 0;
  for (int i = 0; i < vp.size(); ++i) {
    pair<long long, pair<long long, long long> > pp = vp[i];
    long long val = ve_ns * (pp.second.first);
    ed += pp.second.second;
    ans = max(ans, val);
  }
  ans += tot_ns + ed;
  printf("%lld\n", ans);
  return 0;
}
