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

using namespace std;
using ll = long long;
using ld = long double;

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

	int n, q;
	cin >> n >> q;
	vector<int> anc(n), s(n), v(q);
	vector<vector<int>> g(n);
	for (int i = 1; i < n; ++i) {
		cin >> anc[i]; anc[i]--;
		g[anc[i]].push_back(i);
	}
	for (int i = 0; i < n; ++i) {
		cin >> s[i];
		s[i]--;
		s[i] = n - 1 - s[i];
	}
	vector<int> ans(n);
	vector<int> tin(n), tout(n);
	int timer = 0;
	vector<int> max_val(n);
	auto dfs = [&](auto &&dfs, int v) -> void {
		tin[v] = timer++;
		max_val[v] = std::max(max_val[v], s[v]);
		for (int to : g[v]) {
			max_val[to] = max_val[v];
			dfs(dfs, to);
		}
		tout[v] = timer++;
	};
	auto is_anc = [&](int u, int v) -> bool {
		return tin[u] <= tin[v] && tout[v] <= tout[u];
	};
	dfs(dfs, 0);
	for (int i = 0; i < n; ++i) {
		if (i == 0) {
			ans[i] = 0;
			continue;
		}
		int temp = 0;
		vector<int> dp(n);
		auto dfs = [&](auto &&dfs, int v) -> void {
			dp[v] = max_val[v] < max_val[i];
			for (int to : g[v]) {
				dfs(dfs, to);
				dp[v] += dp[to];
			}
		};
		dfs(dfs, 0);
		int j = i;
		while (j > 0) {
			int last_v = j;
			j = anc[j];
			for (int to : g[j]) {
				if (to == last_v) continue;
				temp = std::max(temp, dp[to]);
			}
		}
		int cnt = 0;
		for (int j = 0; j < n; ++j) {
			if (is_anc(j, i) && i != j) {
				cnt++;
				continue;
			}
			if (max_val[j] < max_val[i]) {
				cnt++;
			}
		}
		ans[i] = cnt - temp;
	}

	for (int i = 0; i < q; ++i) {
		cin >> v[i];
		v[i]--;
		cout << ans[v[i]] << ' ';
	}

}
