#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#define all(v) v.begin(), v.end()
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<long long, long long> pii;

const ll INF = 1e16;
const ll SZ = 3e5 + 1;

vector<ll> g[SZ];
priority_queue<pii> pq[SZ];
ll used[SZ];
ll tin[SZ];
ll tout[SZ];
ll s[SZ];
vector<ll> path;

void dfs(ll v) {
	tin[v] = path.size();
	path.push_back(0);
	for (auto u : g[v]) {
		dfs(u);
	}
	tout[v] = path.size();
	path.push_back(0);
}

bool ancestor(ll v, ll u) {
	return (tin[v] <= tin[u] && tout[v] >= tout[u]);
}

struct SegTree {
	ll n;
	vector<ll> a, t, ot;
	SegTree(vector<ll> _a) {
		a = _a;
		n = a.size();
		t.resize(4 * n);
		ot.resize(4 * n);
		build(1, 0, n);
	}
	void update(ll v) {
		t[v] = t[2 * v] + t[2 * v + 1];
	}
	void build(ll v, ll l, ll r) {
		if (r - l == 1) {
			t[v] = a[l];
			return;
		}
		ll m = (l + r) / 2, vl = 2 * v, vr = vl + 1;
		build(vl, l, m);
		build(vr, m, r);
		update(v);
	}
	void push(ll v, ll l, ll r) {
		if (ot[v]) {
			t[v] += (r - l) * ot[v];
			if (r - l > 1) {
				ot[2 * v] += ot[v];
				ot[2 * v + 1] += ot[v];
				return;
			}
			ot[v] = 0;
		}
	}
	ll get(ll v, ll l, ll r, ll al, ll ar) {
		push(v, l, r);
		if (l >= ar || r <= al) return 0;
		if (l >= al && r <= ar) return t[v];
		ll m = (l + r) / 2, vl = 2 * v, vr = vl + 1;
		return get(vl, l, m, al, ar) + get(vr, m, r, al, ar);
	}
	void add(ll v, ll l, ll r, ll al, ll ar, ll x) {
		push(v, l, r);
		if (l >= ar || r <= al) return;
		if (l >= al && r <= ar) {
			ot[v] += x;
			push(v, l, r);
			return;
		}
		ll m = (l + r) / 2, vl = 2 * v, vr = vl + 1;
		add(vl, l, m, al, ar, x);
		add(vr, m, r, al, ar, x);
		update(v);
		return;
	}
};

void solve() {
	ll n, q, v;
	cin >> n >> q;
	vector<ll> p(n, -1);
	for (ll i = 1; i < n; i++) cin >> p[i];
	for (ll i = 0; i < n; i++) cin >> s[i];
	for (ll i = 1; i < n; i++) {
		--p[i];
		g[p[i]].push_back(i);
	}
	vector<ll> qu(q);
	for (ll i = 0; i < q; i++) {
		cin >> qu[i];
		used[--qu[i]] = 1;
	}
	dfs(0);
	SegTree t(path);
	vector<ll> cnt(n);
	vector<ll> ans(n);
	ans[0] = 0;
	for (ll i = 1; i < n; i++) {
		pq[p[i]].push({ s[i], i });
	}
	ll sz = path.size();
	for (ll i = 0; i < n - 1; i++) {
		auto pi = pq[0].top();
		pq[0].pop();
		ll u = pi.se;
		//cout << u << '\n';
		if (used[u]) {
			ll temp = 0;
			for (ll i = 0; i < n; i++) {
				if (!ancestor(i, u)) {
					temp = max(temp, t.get(1, 0, sz, tin[i], tout[i]));
				}
			}
			//cout << "HUI " << i + 1 << ' ' << temp << '\n';
			ans[u] = i + 1 - temp;
		}
		t.add(1, 0, sz, tin[u], tin[u] + 1, 1);
		ll in1 = 0, in2 = u;
		if (pq[in2].size() > pq[in1].size()) {
			swap(pq[in1], pq[in2]);
		}
		while (!pq[in2].empty()) {
			pi = pq[in2].top();
			pq[in2].pop();
			pq[in1].push(pi);
		}
	}
	for (ll i = 0; i < q; i++) {
		cout << ans[qu[i]] << ' ';
	}
	cout << '\n';
}

int main() {
	ll t = 1;
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	cin >> t;
#else
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
#endif
	while (t--) solve();
}
