#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<random>
#include<chrono>
#include<set>
#include<deque>
#include <array>
//define int long long
#define ll long long
#define ld long double
using namespace std;
#pragma GCC optimize("O3, unroll-loops")
#pragma GCC target("avx2")
mt19937 rnd(chrono::steady_clock().now().time_since_epoch().count());
vector<vector<int>> g;
vector<int> v;
vector<int> siz;
void dfs(int s) {
	siz[s] = 1;
	int mx = 0;
	for (auto to : g[s]) {
		dfs(to);
		siz[s] += siz[to];
		mx = max(mx, siz[to]);
	}
	for (auto& to : g[s]) {
		if (siz[to] == mx) {
			swap(g[s][0], to);
		}
	}
}

int timer = 0;
vector<int> tin, tout;
vector<int> tour;
vector<int> nxt;
void dfs2(int s) {
	tin[s] = timer++;
	tour.push_back(s);
	for (auto to : g[s]) {
		if (to == g[s][0]) {
			nxt[to] = nxt[s];
			dfs2(to);
		}
		else {
			nxt[to] = to;
			dfs2(to);
		}
	}
	tout[s] = timer;
}
const int nax = 3e5 + 5;
array<int,2> t[4 * nax];
void update(int v, int tl, int tr, int l, int r, int x) {
	if (l > r) {
		return;
	}
	if (tl == l && tr == r) {
		t[v][1] += x;
	}
	else {
		int tm = (tl + tr) / 2;
		t[v * 2][1] += t[v][1];
		t[v * 2 + 1][1] += t[v][1];
		t[v][1] = 0;
		update(v * 2, tl, tm, l, min(r, tm), x);
		update(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, x);
		t[v][0] = max(t[v * 2][1] + t[v * 2][0], t[v * 2 + 1][1] + t[v * 2 + 1][0]);
	}
}
int query(int v, int tl, int tr, int l, int r) {
	if (l > r) {
		return -1e9;
	}
	if (tl == l && tr == r) {
		return t[v][1] + t[v][0];
	}
	else {
		int tm = (tl + tr) / 2;
		t[v * 2][1] += t[v][1];
		t[v * 2 + 1][1] += t[v][1];
		t[v][1] = 0;
		t[v][0] = max(t[v * 2][1] + t[v * 2][0], t[v * 2 + 1][1] + t[v * 2 + 1][0]);
		return max(query(v * 2, tl, tm, l, min(r, tm)),
			query(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r));
	}
}
vector<int> par;
void upd(int s, int x) {
	while (1) {
		update(1, 0, tour.size() - 1, tin[nxt[s]], tin[s], x);
		if (nxt[s] == 0)break;
		s = par[nxt[s]];
	}
}
void solve() {
	int n, q;
	cin >> n >> q;
	g.resize(n);
	par.assign(n, -1);
	tin.resize(n);
	tout.resize(n);
	siz.resize(n);
	nxt.assign(n, -1);
	for (int i = 1; i < n; i++) {
		int a;
		cin >> a;
		a--;
		g[a].push_back(i);
		par[i] = a;
	}
	v.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	set<pair<int, int>> st;
	vector<int> ord;
	st.insert({ -v[0], 0 });
	while (st.size()) {
		ord.push_back(st.begin()->second);
		int s = st.begin()->second;
		st.erase(st.begin());
		for (auto to : g[s]) {
			st.insert({ -v[to], to });
		}
	}
	dfs(0);
	nxt[0] = 0;
	dfs2(0);
	vector<int> ans(n);
	for (int i = 0; i < n; i++) {
		upd(ord[i], -1e9);
		ans[ord[i]] = i + 1 - max(0, query(1, 0, n - 1, 0, n - 1));
		upd(ord[i], 1e9);
		upd(ord[i], 1);
	}
	for (int rep = 0; rep < q; rep++) {
		int s;
		cin >> s;
		s--;
		cout << ans[s] - 1 << " ";
	}

}

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t;
	//cin >> t;
	t = 1;
	while (t--) {
		solve();
	}
}
