#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 111;
int n, m, q;
vector<int> G[N];
long long Din[N], Dout[N];
vector<int> Grt[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
    if (u > v) {
      ++Din[v];
      ++Dout[u];
      Grt[v].push_back(u);
    } else {
      ++Din[u];
      ++Dout[v];
      Grt[u].push_back(v);
    }
  }
  long long res = 0;
  for (int i = 1; i <= n; ++i) res += Din[i] * Dout[i];
  cout << res << '\n';
  cin >> q;
  while (q--) {
    int u;
    cin >> u;
    res -= Din[u] * Dout[u];
    Dout[u] += Din[u];
    Din[u] = 0;
    for (auto v : Grt[u]) {
      res -= Din[v] * Dout[v];
      Dout[v]--;
      Din[v]++;
      res += Din[v] * Dout[v];
      Grt[v].push_back(u);
    }
    Grt[u].clear();
    cout << res << '\n';
  }
  return 0;
}
