#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=500007;
int read(){
int an=0,f=1;char ch=getchar();
while(!(‘0‘<=ch&&ch<=‘9‘)){if(ch==‘-‘)f=-1;ch=getchar();}
while(‘0‘<=ch&&ch<=‘9‘){an=an*10+(ch-‘0‘);ch=getchar();}
return f*an+1;
}
int n,m,T,sum,ans[maxn],tot;
int x,y;
bool used[maxn];
bool pd[maxn];
int sh[maxn],f[maxn],fa[maxn];
struct saber{
int kkk,to;
}b[maxn];
void add(int x,int y){
sum++;
b[sum].kkk=f[x];
f[x]=sum;
b[sum].to=y;
}
int found(int x){
if(x!=fa[x])fa[x]=found(fa[x]);
return fa[x];
}
void ad(int x){
int p=found(x);
for(int i=f[x];i;i=b[i].kkk){
if(used[b[i].to]){
int q=found(b[i].to);
if(p!=q){fa[q]=p;tot--;}
}
}
}
int main(){
n=read()-1;m=read()-1;
for(int i=1;i<=n;i++)fa[i]=i;
for(int i=1;i<=m;i++){
x=read();y=read();
add(x,y);add(y,x);
}
T=read()-1;
for(int i=1;i<=T;i++){
sh[i]=read();
pd[sh[i]]=1;
}
for(int i=1;i<=n;i++){
if(!pd[i]){
ad(i);
used[i]=1;
tot++;
}
}
ans[T+1]=tot;
for(int i=T;i>=1;i--){
tot++;
ad(sh[i]);
ans[i]=tot;
used[sh[i]]=1;
}
for(int i=1;i<=T+1;i++)printf("%d\n",ans[i]);
return 0;
}