#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n, m, i, j, k, a[N], u, v, q, x;
vector<int> b[N];
long long ans;
long long f(int x) { return 1LL * b[x].size() * (a[x] - b[x].size()); }
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    if (u > v) swap(u, v);
    b[u].push_back(v);
    a[u]++;
    a[v]++;
  }
  scanf("%d", &q);
  for (i = 1; i <= n; i++) ans += f(i);
  printf("%lld\n", ans);
  for (j = 1; j <= q; j++) {
    scanf("%d", &x);
    ans -= f(x);
    for (i = 0; i < b[x].size(); i++)
      ans -= f(b[x][i]), b[b[x][i]].push_back(x), ans += f(b[x][i]);
    b[x].clear();
    printf("%lld\n", ans);
  }
  return 0;
}
