#include <bits/stdc++.h>
using namespace std;
const unsigned long long mod = 1e9 + 7;
template <class S, class T>
ostream& operator<<(ostream& os, const pair<S, T> v) {
  os << "(" << v.first << ", " << v.second << ")";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T> v) {
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      os << " ";
    }
    os << v[i];
  }
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<vector<T>> v) {
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      os << endl;
    }
    os << v[i];
  }
  return os;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> G[n];
  for (int i = 0; i < (int)m; ++i) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vector<long long> outdeg(n, 0);
  vector<int> indeg[n];
  for (int i = 0; i < (int)n; ++i) {
    for (int j = 0; j < (int)G[i].size(); ++j) {
      if (i < G[i][j]) {
        indeg[i].push_back(G[i][j]);
      } else {
        outdeg[i]++;
      }
    }
  }
  long long res = 0;
  for (int i = 0; i < (int)n; ++i) {
    res += indeg[i].size() * outdeg[i];
  }
  cout << res << endl;
  int q;
  cin >> q;
  while (q--) {
    int v;
    cin >> v;
    v--;
    long long v_before = indeg[v].size() * outdeg[v];
    res -= v_before;
    for (int i = 0; i < (int)indeg[v].size(); ++i) {
      outdeg[v]++;
      int next = indeg[v][i];
      long long next_before = indeg[next].size() * outdeg[next];
      res -= next_before;
      indeg[next].push_back(v);
      outdeg[next]--;
      long long next_after = indeg[next].size() * outdeg[next];
      res += next_after;
    }
    indeg[v].clear();
    indeg[v].shrink_to_fit();
    long long v_after = indeg[v].size() * outdeg[v];
    res += v_after;
    cout << res << endl;
  }
  return 0;
}
