#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int n, m, degree[N], q;
vector<int> graph[N];
int main() {
  memset(degree, 0, sizeof(degree));
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    if (u > v) swap(u, v);
    ++degree[u];
    ++degree[v];
    graph[u].push_back(v);
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i)
    ans += 1ll * graph[i].size() * (degree[i] - graph[i].size());
  cin >> q;
  cout << ans << endl;
  while (q--) {
    int u;
    cin >> u;
    ans -= 1ll * graph[u].size() * (degree[u] - graph[u].size());
    for (size_t i = 0; i < graph[u].size(); ++i) {
      int v = graph[u][i];
      ans += degree[v] - graph[v].size() - 1;
      ans -= graph[v].size();
      graph[v].push_back(u);
    }
    cout << ans << endl;
    graph[u].clear();
  }
  return 0;
}
