#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 400010;
int n, m,fa[maxn],cur[maxn], head[maxn],flag[maxn],ans, k,tot, to[maxn], nextt[maxn],can[maxn];
void add(int a, int b)
{
tot++;
to[tot] = b;
nextt[tot] = head[a];
head[a] = tot;
}
int find(int x)
{
return x == fa[x] ? x : fa[x] = find(fa[x]);
}
int main()
{
memset(flag, 1, sizeof(flag));
scanf("%d%d", &n, &m);
for (int i = 1; i <= m; i++)
{
int x, y;
scanf("%d%d", &x, &y);
add(x, y);
add(y, x);
}
scanf("%d", &k);
for (int i = 1; i <= k; i++)
{
scanf("%d", &can[i]);
flag[can[i]] = 0;
}
for (int i = 0; i <= n; i++)
fa[i] = i;
ans = n - k; //先将每个点当作独立的点
for (int u = 1; u <= n; u++) //然后通过边的关系求出删掉要求删的点后的连通块的数量
if (flag[u])
{
for (int i = head[u];i; i = nextt[i])
if (flag[to[i]])
{
int x = find(u), y = find(to[i]);
if (x != y)
{
fa[y] = x;
ans--;
}
}
}
cur[k] = ans;
int u;
for (int t = k; t >= 1; t--)
{
flag[u = can[t]] = 1; //不断的添加点
ans++;
for (int i = head[u]; i; i = nextt[i])
{
if (flag[to[i]])
{
int x = find(u), y = find(to[i]);
if (x != y)
{
fa[y] = x;
ans--;
}
}
}
cur[t - 1] = ans;
}
for (int i = 0; i <= k; i++) //最后顺着输出
printf("%d\n", cur[i]);
return 0;
}