#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
int n, m, q;
int out[maxn];
vector<int> edge[maxn];
vector<int> v[maxn];
bool cmp(const int a, const int b) { return a > b; }
int f[maxn];
long long ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    edge[l].push_back(r);
    edge[r].push_back(l);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < edge[i].size(); j++) {
      int ne = edge[i][j];
      if (ne > i) {
        v[i].push_back(ne);
        continue;
      }
      out[i]++;
      ans += out[ne];
    }
  }
  printf("%lld\n", ans);
  scanf("%d", &q);
  while (q--) {
    int u;
    scanf("%d", &u);
    int sum = 0;
    for (int i = 0; i < v[u].size(); i++) {
      int x = v[u][i];
      ans -= (1ll * v[x].size());
      sum++;
      out[x]--;
      ans += out[x];
      v[x].push_back(u);
    }
    ans -= (1ll) * sum * out[u];
    out[u] += sum;
    v[u].clear();
    printf("%lld\n", ans);
  }
  return 0;
}
