#pragma GCC optimize("O2")
#pragma GCC optimize("Ofast")
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>
using namespace std;
int const N=3e5+10;
vector<int>nei[N];
int P[N];
int val[N];
int ans[N];
int qu[N];
int dn[N];
priority_queue<pair<int,int>>s;
set<pair<int,int>>vl[N];
void bfs()
{
	s.push({val[1],1});
	int t=0;
	while (s.size())
	{
		int u=s.top().second;
		s.pop();
		ans[u]=t++;
		if (qu[u])
		{
			int z=u;
			int f=0;
			while (P[z]!=-1)
			{
				if (vl[P[z]].size())
				{
					if ((*rbegin(vl[P[z]])).second==z)
					{
						auto s=*rbegin(vl[P[z]]);
						vl[P[z]].erase(s);
						if (vl[P[z]].size())
							f=max(f,(*rbegin(vl[P[z]])).first);
						vl[P[z]].insert(s);
					}
					else
						f=max(f,(*rbegin(vl[P[z]])).first);
				}
				z=P[z];
			}
			if (nei[u].size())
				f=max(f,(*rbegin(vl[u])).first);
			ans[u]-=f;
		}
		int z=u;
		while (z!=-1)
		{
			dn[z]++;
			if (z!=1)
			{
				vl[P[z]].erase({dn[z]-1,z});
				vl[P[z]].insert({dn[z],z});
			}
			z=P[z];
		}
		for (auto i:nei[u])
			s.push({val[i],i});
	}
}
inline void solve()
{
	int n,q;
	cin>>n>>q;
	P[1]=-1;
	for (int i=2;i<=n;i++)
	{
		int x;
		cin>>x;
		P[i]=x;
		nei[x].push_back(i);
	}
	for (int i=1;i<=n;i++)
		cin>>val[i];
	vector<int>g;
	for (int i=1;i<=q;i++)
	{
		int x;
		cin>>x;
		qu[x]=i;
		g.push_back(x);
	}
	for (int i=1;i<=n;i++)
	{
		for (int j=0;j<nei[i].size();j++)
			vl[i].insert({0,nei[i][j]});
	}
	bfs();
	for (auto i:g)
		cout<<ans[i]<<' ';
	cout<<endl;
}
signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);cout.tie(NULL);
	int t=1;
	// cin>>t;
	while (t--)
		solve();
}