#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>

struct tree {
	int h;
	std::vector<int> d;
	void build(int n) {
		h = 1;
		while (h < n) {
			h <<= 1;
		}
		d.resize((h << 1) - 1);
	}
	void upd(int i, int tl, int tr, int ql, int qr, int qx) {
		if (tl >= qr || tr <= ql) {
			return;
		}
		if (ql <= tl && tr <= qr) {
			d[i] = std::max(d[i], qx);
			return;
		}
		const int j = (i << 1) + 1, tm = (tl + tr) >> 1;
		upd(j, tl, tm, ql, qr, qx);
		upd(j + 1, tm, tr, ql, qr, qx);
	}
	int get(int i) {
		int a = 0;
		i += h - 1;
		while (i > 0) {
			a = std::max(d[i], a);
			i = (i - 1) >> 1;
		}
		return a;
	}
};
tree t;
const int maxn = 1e5;
std::vector<std::vector<int>> g;
std::vector<int> al;
int tin[maxn], tout[maxn], p[maxn], ans[maxn], sz[maxn];
bool used[maxn], eng[maxn];
void dfs(int i) {
	al.push_back(i);
	tin[i] = al.size();
	for (int to : g[i]) {
		dfs(to);
	}
	tout[i] = al.size();
}
void insert_v(int i, int last, int d) {
	sz[i] += d;
	if (tin[i] != tin[last] - 1) {
		t.upd(0, 0, t.h, tin[i], tin[last] - 1, sz[last]);
	}
	if (tout[last] != tout[i]) {
		t.upd(0, 0, t.h, tout[last], tout[i], sz[last]);
	}
	if (p[i] != -1 && used[p[i]]) {
		insert_v(p[i], i, d);
	}
}
void dfs2(int i) {
	eng[i] = 1;
	ans[i] = sz[0] - t.get(tin[i] - 1);
	for (int to : g[i]) {
		if (used[to]) {
			dfs2(to);
		}
	}
}
int main() {
	int n, q;
	std::cin >> n >> q;
	p[0] = -1;
	g.resize(n);
	t.build(n);
	for (int i = 1; i < n; ++i) {
		std::cin >> p[i];
		--p[i];
		g[p[i]].push_back(i);
	}
	dfs(0);
	std::pair<int, int> s[maxn];
	for (int i = 0; i < n; ++i) {
		std::cin >> s[i].first;
		s[i].first = -s[i].first;
		s[i].second = i;
	}
	std::sort(s, s + n);
	eng[0] = 1;
	used[0] = 1;
	for (int i = 0; i < n; ++i) {
		int v = s[i].second;
		if (v == 0) {
			continue;
		}
		used[v] = 1;
		sz[v] = 1;
		for (int to : g[v]) {
			sz[v] += sz[to];
		}
		insert_v(p[v], v, sz[v]);
		if (eng[p[v]]) {
			dfs2(v);
		}
	}
	for (int i = 0; i < q; ++i) {
		int v;
		std::cin >> v;
		--v;
		std::cout << ans[v] << ' ';
	}
}
