#include <bits/stdc++.h>
using namespace std;
int const Nmax = 1e5 + 5;
vector<int> Adj[Nmax];
int n, m, q;
int deg[Nmax];
int val[Nmax];
int64_t Count = 0;
void Solve() {
  cin >> q;
  cout << Count << '\n';
  for (int k = (int)1; k <= (int)q; ++k) {
    int u;
    cin >> u;
    for (int i = 0; i < (int)Adj[u].size(); ++i) {
      int v = Adj[u][i];
      Count -= (deg[u] - Adj[u].size());
      Count += (deg[v] - Adj[v].size() - 1);
      Count -= Adj[v].size();
      Adj[v].push_back(u);
    }
    Adj[u].clear();
    cout << Count << '\n';
  }
}
void Enter() {
  cin >> n >> m;
  for (int i = (int)1; i <= (int)m; ++i) {
    int x, y;
    cin >> x >> y;
    if (x > y) swap(x, y);
    Adj[x].push_back(y);
    deg[x]++;
    deg[y]++;
  }
  for (int i = (int)1; i <= (int)n; ++i)
    Count += (deg[i] - Adj[i].size()) * Adj[i].size();
}
int main() {
  {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  Enter();
  Solve();
}
