#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <random>
#include <map>
#include <queue>

using namespace std;
using ll = long long;

const int maxn = 3e5;
vector<int> g[maxn];
int s[maxn], pr[maxn], p[maxn], sz[maxn], id[maxn], mx[1<<20], add[1<<20], rs[maxn];
int  cr = 0;

void dfs(int v) {
	sz[v] = 1;
	for (auto u : g[v]) {
		dfs(u);
		sz[v] += sz[u];
	}
	for (int i = 1; i < g[v].size(); ++i) {
		if (sz[g[v][i]] > sz[g[v][0]]) {
			swap(g[v][i], g[v][0]);
		}
	}
}

void dfs_id(int v) {
	id[v] = cr++;
	for (int i = 0; i < g[v].size(); ++i) {
		if (i == 0) {
			pr[g[v][i]] = pr[v];
			dfs_id(g[v][i]);
		}
		else {
			pr[g[v][i]] = g[v][i];
		}
		dfs_id(g[v][i]);
	}
}

void push(int v) {
	add[2 * v] += add[v];
	add[2 * v + 1] += add[v];
	mx[2 * v] += add[v];
	mx[2 * v + 1] += add[v];
	add[v] = 0;
}

void upd(int v, int l, int r, int tl, int tr) {
	if (l >= tr || tl >= r) return;
	if (l >= tl && r <= tr) {
		++add[v];
		++mx[v];
		return;
	}
	int m = (l + r) / 2;
	push(v);
	upd(2 * v, l, m, tl, tr);
	upd(2 * v + 1, m, r, tl, tr);
	mx[v] = max(mx[2 * v], mx[2 * v + 1]);
}

int get(int v, int l, int r, int tl, int tr) {
	if (l >= tr || tl >= r) return 0;
	if (l >= tl && r <= tr) return mx[v];
	int m = (l + r) / 2;
	push(v);
	return max(get(2 * v, l, m, tl, tr), get(2 * v + 1, m, r, tl, tr));
}

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

	int n, q;
	cin >> n >> q;
	for (int i = 1; i < n; ++i) {
		cin >> p[i];
		--p[i];
		g[p[i]].push_back(i);
	}
	for (int i = 0; i < n; ++i) {
		cin >> s[i];
	}
	dfs(0);
	dfs_id(0);
	int cntt = 0;
	set<pair<int, int>> st;
	st.insert({ s[0], 0 });
	while (!st.empty()) {
		int v = (*st.rbegin()).second;
		st.erase(*st.rbegin());
		for (auto u : g[v]) {
			st.insert({ s[u], u });
		}
		int vr = v;
		vector<pair<int, int>> vc;
		while (1) {
			vc.push_back({ id[pr[vr]], id[vr] });
			if (pr[vr] == 0) break;
			vr = p[pr[vr]];
		}
		rs[v] = cntt;
		int mxx = 0;
		reverse(vc.begin(), vc.end());
		for (int j = 0; j < vc.size(); ++j) {
			upd(1, 0, n, vc[j].first, vc[j].second + 1);
		}
		mxx = max(mxx, get(1, 0, n, 0, vc[0].first));
		mxx = max(mxx, get(1, 0, n, vc.back().second + 1, n));
		for (int j = 1; j < vc.size(); ++j) {
			mxx = max(mxx, get(1, 0, n, vc[j - 1].second + 1, vc[j].first));
		}
		rs[v] -= mxx;
		++cntt;
	}
	for (int i = 0; i < q; ++i) {
		int f;
		cin >> f;
		--f;
		cout << rs[f] << ' ';
	}

	return 0;
}
