#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;


int t = 0;
vector<vector<int>> g;
vector<int> s, p;
map<pair<int, int>, pair<int, int>> mem;


int dfs(int v, int mn) {
	//cout << "a " << v << ' ' << mn << endl;
	if (s[v] < mn)
		return 0;
	int cnt = 1;
	for (int u : g[v])
		cnt += dfs(u, mn);
	return cnt;
}


int up(int v, int par, int cnt, int mn, int mx) {
	//cout << "chech " << v << ' ' << cnt << ' ' << mx << endl;
	if (v == 0)
		return cnt - mx;
	if (mem.find({ v, mn }) != mem.end()) {
		cnt += mem[{ v, mn }].first;
		mx = max(mx, mem[{ v, mn }].second);
		return up(p[v], v, cnt, mn, mx);
	}
	cnt++;
	int lm = 0, lcnt = 0, res;
	for (int u : g[v]) {
		if (u == par)
			continue;
		res = dfs(u, mn);
		cnt += res, mx = max(mx, res);
		lcnt += res, lm = max(lm, res);
	}
	mn = min(mn, s[v]), mem[{ v, mn }] = { lcnt, lm };
	return up(p[v], v, cnt, mn, mx);
}


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, q;
	cin >> n >> q;
	g.resize(n + 1);
	s.resize(n + 1);
	p.resize(n + 1, 0);
	for (int v = 2; v <= n; v++) {
		cin >> p[v];
		g[p[v]].push_back(v);
	}
	for (int i = 1; i <= n; i++)
		cin >> s[i];
	int v;
	for (int i = 0; i < q; i++) {
		cin >> v;
		cout << up(p[v], v, 0, s[v], 0) << ' ';
	}
	cout << '\n';
}
