#include <bits/stdc++.h>
using namespace std;
const int M = 100005;
int n, m, q, in[M], out[M], tot, head[M], Next[M * 50], vet[M * 50];
long long ans;
void add(int a, int b) {
  Next[++tot] = head[a], vet[tot] = b;
  head[a] = tot;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (a > b) swap(a, b);
    add(a, b);
    out[a]++;
    in[b]++;
    ans += in[a] + out[b];
  }
  printf("%lld\n", ans);
  scanf("%d", &q);
  while (q--) {
    int x;
    scanf("%d", &x);
    for (int i = head[x]; i;) {
      int y = vet[i], nxt = Next[i];
      ans -= in[x] + out[y];
      out[x]--;
      in[y]--;
      Next[i] = head[y], vet[i] = x, head[y] = i;
      in[x]++;
      out[y]++;
      ans += out[x] + in[y];
      i = nxt;
    }
    head[x] = 0;
    printf("%lld\n", ans);
  }
  return 0;
}
