//#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#pragma GCC target("avx2")

using namespace std;

typedef int ll;

const ll INF = 1'000'000'000;

template<typename T>
bool assign_max(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template<typename T>
bool assign_min(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

struct segment_tree {
	vector<ll> tree, m;
	ll sz;
	segment_tree(ll n = 0) {
		sz = 1;
		while (sz < n) {
			sz *= 2;
		}
		tree.resize(sz * 2, 0);
		m.resize(sz * 2, 0);
	}
	/*
	void add(ll v, ll x) {
		tree[v] += x;
		m[v] += x;
	}
	void pull(ll v) {
		tree[v] = max(tree[v * 2], tree[v * 2 + 1]) + m[v];
	}
	*/
	ll get(ll l, ll r) {
		if (l >= r) {
			return 0;
		}
		l += sz;
		r += sz;
		ll ansl = tree[l], ansr = -INF;
		while ((l >> 1) != (r >> 1)) {
			if (!(l & 1)) {
				assign_max(ansl, tree[l ^ 1]);
			}
			if (r & 1) {
				assign_max(ansr, tree[r ^ 1]);
			}
			l >>= 1;
			r >>= 1;
			ansl += m[l];
			ansr += m[r];
		}
		ll ans = max(ansl, ansr);
		while (l > 1) {
			l >>= 1;
			ans += m[l];
		}
		return ans;
	}
	/*
	ll get(ll l, ll r) {
		return get(1, 0, sz, l, r);
	}
	ll get(ll v, ll l, ll r, ll ql, ll qr) {
		if (ql <= l && r <= qr) {
			return tree[v];
		}
		if (qr <= l || r <= ql) {
			return 0;
		}
		ll mid = (l + r) / 2;
		return max(get(v * 2, l, mid, ql, qr), get(v * 2 + 1, mid, r, ql, qr)) + m[v];
	}
	*/
	void add(ll l, ll r) {
		if (l >= r) {
			return;
		}
		l += sz;
		r += sz;
		tree[l]++;
		while ((l >> 1) != (r >> 1)) {
			if (!(l & 1)) {
				m[l ^ 1]++;
				tree[l ^ 1]++;
			}
			if (r & 1) {
				m[r ^ 1]++;
				tree[r ^ 1]++;
			}
			l >>= 1;
			r >>= 1;
			tree[l] = max(tree[l << 1], tree[(l << 1) ^ 1]) + m[l];
			tree[r] = max(tree[r << 1], tree[(r << 1) ^ 1]) + m[r];
		}
		while (l > 1) {
			l >>= 1;
			tree[l] = max(tree[l << 1], tree[(l << 1) ^ 1]) + m[l];
		}
	}
	/*
	void add(ll l, ll r, ll x) {
		add(1, 0, sz, l, r, x);
	}
	void add(ll v, ll l, ll r, ll ql, ll qr, ll x) {
		if (ql <= l && r <= qr) {
			add(v, x);
			return;
		}
		if (qr <= l || r <= ql) {
			return;
		}
		ll mid = (l + r) / 2;
		add(v * 2, l, mid, ql, qr, x);
		add(v * 2 + 1, mid, r, ql, qr, x);
		pull(v);
	}
	*/
};

struct HLD {
	segment_tree st;
	vector<ll> reorder, mp, sz, p;
	ll n;
	HLD(vector<vector<ll>> sons) {
		n = sons.size();
		st = segment_tree(n);
		reorder.resize(n);
		mp.resize(n);
		sz.resize(n);
		p.resize(n);
		dfs(0, sons);
		ll num = 0;
		mp[0] = 0;
		dfs2(0, -1, num, sons);
		vector<ll> nsz(n);
		for (ll j = 0; j < n; j++) {
			nsz[reorder[j]] = sz[j];
		}
		sz = nsz;
	}
	void dfs(ll v, vector<vector<ll>>& sons) {
		sz[v] = 1;
		for (auto j : sons[v]) {
			dfs(j, sons);
			sz[v] += sz[j];
		}
	}
	void dfs2(ll v, ll np, ll& num, vector<vector<ll>>& sons) {
		p[num] = np;
		reorder[v] = num;
		num++;
		vector<pair<ll, ll>> s;
		for (auto j : sons[v]) {
			s.emplace_back(sz[j], j);
		}
		sort(s.begin(), s.end());
		bool b = true;
		for (auto[_, j] : s) {
			if (b) {
				mp[num] = mp[reorder[v]];
			} else {
				mp[num] = num;
			}
			b = false;
			dfs2(j, reorder[v], num, sons);
		}
	}
	void add(ll v) {
		v = reorder[v];
		while (v != -1) {
			st.add(mp[v], v + 1);
			v = p[mp[v]];
		}
	}
	ll get(ll v) {
		v = reorder[v];
		ll ans = 0;
		assign_max(ans, st.get(v + sz[v], n));
		while (v != -1) {
			if (p[mp[v]] != -1) {
				assign_max(ans, st.get(p[mp[v]] + 1, mp[v]));
			}
			v = p[mp[v]];
		}
		return ans;
	}
};

void solve() {
	ll n, q;
	cin >> n >> q;
	vector<ll> p(n);
	vector<vector<ll>> sons(n);
	p[0] = -1;
	for (ll i = 1; i < n; i++) {
		cin >> p[i];
		p[i]--;
		sons[p[i]].push_back(i);
	}
	vector<ll> s(n);
	for (ll i = 0; i < n; i++) {
		cin >> s[i];
	}
	ll nc = 0;
	vector<multiset<ll>> csons(n);
	for (ll i = 0; i < n; i++) {
		for (ll j = 0; j <= sons[i].size(); j++) {
			csons[i].insert(0);
		}
	}
	vector<ll> qs(q);
	vector<bool> need(n, false);
	for (ll i = 0; i < q; i++) {
		cin >> qs[i];
		qs[i]--;
		need[qs[i]] = true;
	}
	vector<ll> cpd(n);
	vector<ll> ans(n);
	set<pair<ll, ll>> all;
	all.emplace(s[0], 0);
	HLD h(sons);
	while (!all.empty()) {
		auto[x, v] = *all.rbegin();
		all.erase(make_pair(x, v));
		ans[v] = nc;
		for (auto j : sons[v]) {
			all.emplace(s[j], j);
		}
		nc++;
		h.add(v);
		if (need[v]) {
			ans[v] -= h.get(v);
		}
	}
	for (ll i = 0; i < q; i++) {
		cout << ans[qs[i]] << ' ';
	}
	cout << '\n';
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	solve();
}
