#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m, q;
long long ans;
int f[N];
vector<int> to[N];
int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 3) + (s << 1) + ch - '0', ch = getchar();
  return s * w;
}
void swap(int &a, int &b) {
  int t = a;
  a = b;
  b = t;
  return;
}
long long calc(int i) { return 1LL * (f[i] - to[i].size()) * to[i].size(); }
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= m; ++i) {
    int a = read(), b = read();
    if (a > b) swap(a, b);
    to[a].push_back(b);
    ++f[a];
    ++f[b];
  }
  for (int i = 1; i <= n; ++i) ans += calc(i);
  printf("%lld\n", ans);
  q = read();
  for (int i = 1; i <= q; ++i) {
    int v = read();
    ans -= calc(v);
    for (int j = 0; j < to[v].size(); ++j) {
      int at = to[v][j];
      ans -= calc(at);
      to[at].push_back(v);
      ans += calc(at);
    }
    to[v].clear();
    printf("%lld\n", ans);
  }
  return 0;
}
