#include <bits/stdc++.h>
using namespace std;
int n, i, m, k, c[1001], u, t, Max(0), res(0), f[1001], cnt[1001], p(0);
int find(int x) { return f[x] == x ? x : find(f[x]); }
void Init() {
  cin >> n >> m >> k;
  for (i = 1; i <= k; i++) cin >> c[i];
  for (i = 1; i <= n; i++) f[i] = i;
  for (i = 1; i <= m; i++) {
    cin >> u >> t;
    f[find(u)] = find(t);
  }
  for (i = 1; i <= n; i++) cnt[find(i)]++;
  for (i = 1; i <= k; i++)
    Max = max(Max, cnt[find(c[i])]),
    res += cnt[find(c[i])] * (cnt[find(c[i])] - 1) / 2, p += cnt[find(c[i])];
  res = res - Max * (Max - 1) / 2 + (Max + n - p) * (Max + n - p - 1) / 2 - m;
  cout << res;
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  Init();
}
