#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int N, M;
int A[100001], B[100001];
long long ans = 0;
vector<int> sless[100001], smore[100001];
void del(int Y, int X) {
  for (int i = 0; i < (int)sless[Y].size(); i++)
    if (sless[Y][i] == X) {
      sless[Y].erase(sless[Y].begin() + i);
      return;
    }
}
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 0; i < M; i++) {
    scanf("%d%d", &A[i], &B[i]);
    if (A[i] > B[i]) {
      sless[A[i]].push_back(B[i]);
      smore[B[i]].push_back(A[i]);
    } else {
      sless[B[i]].push_back(A[i]);
      smore[A[i]].push_back(B[i]);
    }
  }
  for (int i = 1; i <= N; i++)
    ans += (long long)(sless[i].size()) * (long long)(smore[i].size());
  int Q;
  scanf("%d", &Q);
  while (Q--) {
    int X;
    scanf("%d", &X);
    printf("%I64d\n", ans);
    ans -= (long long)(sless[X].size()) * (long long)(smore[X].size());
    for (auto Y : smore[X]) {
      ans -= smore[Y].size();
      del(Y, X);
      smore[Y].push_back(X);
      sless[X].push_back(Y);
      ans += sless[Y].size();
    }
    smore[X].clear();
  }
  printf("%I64d\n", ans);
  return 0;
}
