#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return x * f;
}
int n, in[100010], out[100010], m, Q;
long long ans;
vector<int> S[100010];
int main() {
  n = read(), m = read();
  for (int i = 1; i <= m; ++i) {
    int u = read(), v = read();
    if (u < v) swap(u, v);
    ++out[u], ++in[v];
    S[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i) {
    ans += 1LL * in[i] * out[i];
  }
  printf("%lld\n", ans);
  Q = read();
  while (Q--) {
    int u = read();
    ans -= 1LL * in[u] * out[u];
    out[u] += in[u], in[u] = 0;
    for (auto v : S[u]) {
      S[v].push_back(u);
      ans -= 1LL * in[v] * out[v];
      --out[v], ++in[v];
      ans += 1LL * in[v] * out[v];
    }
    S[u].clear();
    printf("%lld\n", ans);
  }
  return 0;
}
