#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
using ll = long long;
using ld = long double;
const int INF = 1e9;
const int sz = 3 * 1e5;

int a[sz], dp[sz], s[sz], p[sz];
vector<int> g[sz];
vector<int> ind, pos;

vector<vector<int>> path, pref_min;

void dfs(int u, int p, int mins) {
	path.back().push_back(u);
	ind[u] = path.size() - 1;
	pos[u] = path.back().size() - 1;
	pref_min.back().push_back(mins);
	for (int v : g[u]) {
		if (v != p)
			dfs(v, u, min(mins, s[v]));
	}
}
struct elem {
	int val, e, i;
};
bool cmp(elem e1, elem e2) {
	return e1.val > e2.val;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n, q;
	cin >> n >> q;
	p[0] = -1;
	for (int i = 1; i < n; ++i) {
		cin >> p[i];
		p[i]--;
		g[i].push_back(p[i]);
		g[p[i]].push_back(i);
	}
	for (int i = 0; i < n; ++i)
		cin >> s[i];
	ind.resize(n);
	pos.resize(n);
	for (int v : g[0]) {
		path.emplace_back();
		pref_min.emplace_back();
		dfs(v, 0, s[v]);
	}
	vector<elem> ques;
	vector<int> ans(q);
	for (int e = 0; e < q; ++e) {
		int u; cin >> u; u--;
		if (u == 0) {
			ans[e] = 0;
			continue;
		}
		int i = ind[u];
		ans[e] = pos[u] + 1;
		ques.push_back({ pref_min[ind[u]][pos[u]], e, i });
	}
	sort(ques.begin(), ques.end(), cmp);
	vector<int> cnt(path.size(), 0);
	int sum_cnt = 0;
	set<pair<int, int>> se;
	for (int i = 0; i < path.size(); ++i) {
		se.insert({ -pref_min[i][0], i });
	}
	set<pair<int, int>> cnt_max;
	for (auto el : ques) {
		int val = el.val, e = el.e, i = el.i;
		while (!se.empty() && -se.begin()->first >= val) {
			sum_cnt++;
			int i = se.begin()->second;
			cnt_max.erase({ -cnt[i], i });
			cnt[i]++;
			cnt_max.insert({ -cnt[i], i });
			se.erase(se.begin());
			if (cnt[i] < pref_min[i].size())
				se.insert({-pref_min[i][cnt[i]], i});
		}
		int cnt_add = 0;
		if (cnt_max.begin()->second != i)
			cnt_add = -cnt_max.begin()->first;
		else if (cnt_max.size() > 1)
			cnt_add = -next(cnt_max.begin())->first;
		ans[e] += sum_cnt - cnt[i] - cnt_add;
	}
	for (int el : ans) cout << el << " ";

	return 0;
}