#include <bits/stdc++.h>
using namespace std;
void file_put() {
  freopen("filename.in", "r", stdin);
  freopen("filename.out", "w", stdout);
}
const int N = 1e5 + 5;
int n, m, Q, d[N], q, x, y;
vector<int> V[N];
long long ans = 0;
long long cal(int x) {
  return (long long)(int)V[x].size() * (d[x] - (int)V[x].size());
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (1); i < (m + 1); i++)
    scanf("%d%d", &x, &y), V[min(x, y)].push_back(max(x, y)), d[x]++, d[y]++;
  for (int i = (1); i < (n + 1); i++) ans += cal(i);
  printf("%lld\n", ans);
  scanf("%d", &Q);
  while (Q--) {
    scanf("%d", &x), ans -= cal(x);
    for (auto y : V[x])
      ans += d[y] - 1 - 2 * (int)V[y].size(), V[y].push_back(x);
    V[x].clear();
    printf("%lld\n", ans);
  }
  return 0;
}
