#include <bits/stdc++.h>
using namespace std;
const int ms = 100010;
vector<int> g[ms];
int in[ms], out[ms];
int main() {
  int n, m;
  int a, b;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &a, &b);
    if (a > b) swap(a, b);
    in[a]++, out[b]++;
    g[a].push_back(b);
  }
  long long res = 0;
  for (int i = 0; i < n; ++i) {
    res += 1ll * in[i + 1] * out[i + 1];
  }
  printf("%lld\n", res);
  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    scanf("%d", &a);
    res -= 1ll * out[a] * in[a];
    for (int j : g[a]) {
      res -= 1ll * out[j] * in[j];
      g[j].push_back(a);
      out[a]++;
      in[j]++;
      out[j]--;
      res += 1ll * out[j] * in[j];
    }
    g[a].clear();
    in[a] = 0;
    printf("%lld\n", res);
  }
  return 0;
}
