#include <bits/stdc++.h>
#pragma GCC optimization("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
const int N = 1e5 + 7;
const int INF = 1e9 + 7;
long long con[N], inc[N], outc[N], s;
int n, m, q;
vector<int> in[N];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (a < b) swap(a, b);
    in[b].push_back(a);
    inc[b]++;
    outc[a]++;
  }
  for (int i = 1; i <= n; i++) {
    con[i] = outc[i] * inc[i];
    s += con[i];
  }
  cin >> q;
  printf("%lld\n", s);
  for (int i = 1; i <= q; i++) {
    int v;
    scanf("%d", &v);
    s -= con[v];
    for (int to : in[v]) {
      s -= con[to];
      in[to].push_back(v);
      inc[to]++;
      outc[to]--;
      inc[v]--;
      outc[v]++;
      con[to] = outc[to] * inc[to];
      s += con[to];
    }
    in[v].clear();
    con[v] = outc[v] * inc[v];
    s += con[v];
    printf("%lld\n", s);
  }
}
