#include <bits/stdc++.h>
int a[100005], b[100005], c[100005], e[100005], f[100005], g[100005], m, n, t;
long long x;
bool w[100005][450];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, u, v; i <= m; i++) {
    scanf("%d%d", &u, &v);
    if (u > v) u ^= v ^= u ^= v;
    e[v]++, f[u]++, x += e[u] + f[v], b[++t] = a[u], c[a[u] = t] = v;
  }
  scanf("%d", &m), printf("%lld\n", x), t = m + 1;
  for (int i = 1, u; i <= m; i++) {
    scanf("%d", &u);
    for (int& i = a[u]; i; i = b[i])
      f[u]--, e[c[i]]--, x -= e[u] + f[c[i]], e[u]++, f[c[i]]++,
          x += f[u] + e[c[i]], b[t] = a[c[i]], c[a[c[i]] = t] = u, t = i;
    printf("%lld\n", x);
  }
  return 0;
}
