#include <bits/stdc++.h>
// #include <bits/extc++.h>

using namespace std;

#define all(a)	a.begin(),a.end()
#define rall(a)	a.rbegin(),a.rend()
#define FastIO	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long			ll;
typedef long double			ld;
typedef unsigned long long	ull;
// typedef _int128_t lll;

template<typename T1, typename T2>
ostream& operator<< (ostream &x, const pair<T1, T2> &pr) { return x << "{" << pr.first << ", " << pr.second << "}"; }
// template<typename T> void cerr_cont(const T &cont) { for (auto &it : cont) cerr << it << ' '; }
template<typename T> void print_cont(const T &cont, ostream &x=cout) { for (auto &it : cont) x << it << ' '; }

int n, q;
vector<int> p;
vector<vector<int>> g;

vector<int> w;

struct SegmentTree {
	int n;
	vector<int> d;
	vector<int> t;

	void push(int v) {
		if (!t[v]) return;
		if (v < n - 1) {
			t[v * 2 + 1] += t[v];
			t[v * 2 + 2] += t[v];
		}
		d[v] += t[v];
		t[v] = 0;
		
	}

	SegmentTree() {}
	SegmentTree(int tn) {
		n = 1;
		while (n < tn) n <<= 1;
		
		d.resize(n * 2 - 1, 0);
		t.resize(n * 2 - 1, 0);
	}

	void add(int v, int lt, int rt, int L, int R, int val) {
		push(v);
		if (L <= lt && rt <= R) {
			t[v] += val;
			push(v);
			return;
		}
		if (R <= lt || rt <= L) return;
		int m = (lt + rt) / 2;
		add(v * 2 + 1, lt, m, L, R, val);
		add(v * 2 + 2, m, rt, L, R, val);
		d[v] = max(d[v * 2 + 1], d[v * 2 + 2]);
	}
	void add(int lt, int rt, int val) {
		add(0, 0, n, lt, rt, val);
	}
	
	int query(int v, int lt, int rt, int L, int R) {
		push(v);
		if (L <= lt && rt <= R) return d[v];
		if (R <= lt || rt <= L) return -1;
		
		int m = (lt + rt) / 2;
		return max(
				query(v * 2 + 1, lt, m, L, R),
				query(v * 2 + 2, m, rt, L, R)
				);
	}
	int query(int lt, int rt) {
		return query(0, 0, n, lt, rt);
	}

	void print_leaves() {
		for (int v = 0; v < n * 2 - 1; ++v) push(v);
		// for (int v = n - 1; v < n * 2 - 1; ++v) cerr << d[v] << ' ';
	}
};

struct HLD {
	int n;

	vector<vector<int>> g;
	vector<int> pred;
	vector<int> h;


	void rearrange(int v, int p) {
		h[v] = (v == p ? 0 : h[p] + 1);
		for (auto u : g[v]) {
			pred[u] = v;
			rearrange(u, v);
		}
		sort(all(g[v]), [&](int a, int b){
				return h[a] > h[b];
				});
	}

	vector<int> up;

	int timer = 0;
	vector<int> tin, tout;

	void dfs(int v, int p) {
		tin[v] = timer++;
		if (g[v].size()) {
			up[g[v][0]] = up[v];
		}

		for (auto u : g[v]) {
			dfs(u, v);
		}
		tout[v] = timer;
	}

	vector<pair<int, int>> segments(int v) {
		vector<pair<int, int>> res;
		do {
			res.emplace_back(tin[up[v]], tin[v]);
			v = pred[up[v]];
		} while (v != -1); 
		reverse(all(res));
		return res;
	}

	SegmentTree d;

	HLD () {} 
	HLD (const vector<vector<int>> &tg): g(tg) {
		n = (int) g.size();

		h.resize(n, 0);
		pred.resize(n, -1);

		rearrange(0, 0);

		up.resize(n);
		iota(all(up), 0);

		tin.resize(n);
		tout.resize(n);

		dfs(0, 0);


		d = SegmentTree(n);

		// cerr << "HLD DATA: " << endl;

		// cerr << "\ttin: ";
		// cerr_cont(tin);
		// cerr << endl;

		// cerr << "\th: ";
		// cerr_cont(h);
		// cerr << endl;

		// cerr << "\tup: ";
		// cerr_cont(up);
		// cerr << endl;

		// cerr << "\tpred: ";
		// cerr_cont(pred);
		// cerr << endl;
	}

	void add(int v) {
		for (auto &[lt, rt] : segments(v)) {
			d.add(lt, rt + 1, 1);
		}
	}

	int query(int v) {
		auto sgts = segments(v);
		sgts.emplace_back(n, -1);
		int lst = 0;
		int res = -1;
		for (auto &[lt, rt] : sgts) {
			if (lst != lt) res = max(res, d.query(lst, lt));
			lst = rt + 1;
		}
		return res;
	}
	
};

int main() {
	FastIO;
	cin >> n >> q;

	p.resize(n, 0);
	g.resize(n, vector<int>());

	for (int v = 1; v < n; ++v) {
		cin >> p[v]; --p[v];
		g[p[v]].emplace_back(v);
	}


	w.resize(n);
	for (auto &it : w) cin >> it;

	for (int v = 0; v < n; ++v) {
		sort(all(g[v]), [&w](int u, int v){
				return w[u] > w[v];
				});
	}


	set<pair<int, int>> st;
	st.insert(make_pair(-w[0], 0));

	HLD d = HLD(g);

	int cnt = 0;
	vector<int> ans(n, -1);

	while (!st.empty()) {
		auto [_, v] = (*st.begin()); st.erase(st.begin());
		d.add(v);
		ans[v] = cnt - d.query(v);
		++cnt;
		for (auto u : g[v]) {
			st.insert(make_pair(-w[u], u));
		}

		// cerr << "SegmentTree: ";
		// d.d.print_leaves(); // cerr
		// cerr << endl;
	}

	// cerr << "ans: ";
	// cerr_cont(ans);
	// cerr << endl;

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

	return 0;
}

