#include<iostream>
#include<cstdio>
#include <math.h>
using namespace std;
intfather[400001]={0},next[400001]={0},point[400001]={0},root[400001]={0},now=0;
bool h[400001]={false};
void add(int a,int b)
{
now++;
point[now]=a;
next[now]=root[b];
root[b]=now;
}
int find(int v)
{
if(v==father[v])return v;
return father[v]=find(father[v]);
}
void unio(int a,int b)
{
father[find(a)]=father[find(b)];
}
int main()
{
int n,m,t,x[400001]={0},y[400001]={0},k,a[400001]={0},ans[400001]={0},j;
scanf("%d%d",&n,&m);
for (int i=1;i<=n;i++)father[i]=i;//初始化并查集
for (int i=1;i<=m;i++)
{
scanf("%d%d",&x[i],&y[i]);
add(x[i],y[i]);
add(y[i],x[i]);//邻接表
}
scanf("%d",&k);
t=n-k;
for (int i=1;i<=k;i++)
{
scanf("%d",&a[k-i+1]);
h[a[k-i+1]]=true;
}
for (int i=1;i<=m;i++)
if((h[x[i]]==false)&&(h[y[i]]==false)&&(find(x[i])!=find(y[i])))
{
unio(x[i],y[i]);t--;
}
ans[0]=t;
for (int i=1;i<=k;i++)
{
t++;
h[a[i]]=false;
j=root[a[i]];
while (j!=0)
{
if ( find(point[j])!=find(a[i]) && (h[point[j]]==false) )
{
unio(point[j],a[i]);
t--;
}
j=next[j];
}
ans[i]=t;
}
for (inti=k+1;i>=1;i--)printf("%d\n",ans[i-1]);
return 0;
}