#include <iostream>
#include <vector>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#define int long long
#define ld long double

using namespace std;
vector<vector<int>> graph;
vector<bool> used;
vector<int> p;
vector<int> s;
vector<vector<int>> lines;
int it = 0;
void dfs(int v) {
	lines[it].push_back(v);
	used[v] = true;
	for (int x : graph[v]) {
		if (!used[x]) dfs(x);
	}
}
void solve() {
	int n, q;
	cin >> n >> q;
	graph.resize(n);
	used.resize(n);
	p.resize(n);
	s.resize(n);
	vector<int> qs(q);
	for (int i = 1; i < n; i++) {
		cin >> p[i];
		p[i]--;
		graph[i].push_back(p[i]);
		graph[p[i]].push_back(i);
	}
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	set<int> rlq;
	for (int i = 0; i < q; i++) {
		cin >> qs[i];
		qs[i]--;
		rlq.insert(qs[i]);
	}
	vector<int> its(graph[0].size(), 0);

	used[0] = true;
	lines.resize(graph[0].size());
	for (int x : graph[0]) {
		dfs(x);
		it++;
	}
	vector<pair<int, int>> forv(n);//какая линия и какой по счету в этой линии
	for (int i = 0; i < graph[0].size(); i++) {
		for (int j = 0; j < lines[i].size(); j++) {
			forv[lines[i][j]] = { i, j };
		}
	}
	vector<pair<int, int>> que;
	set<pair<int, int>> cur;
	int it = 0;
	for (int x : graph[0]) {
		cur.insert({ -s[x], it });
		it++;
	}
	while (!cur.empty()) {
		auto v = *cur.begin();
		cur.erase(cur.begin());
		que.push_back({ v.second, lines[v.second][its[v.second]] });
		its[v.second]++;
		if (its[v.second] != lines[v.second].size()) {
			cur.insert({ -s[lines[v.second][its[v.second]]], v.second });
		}
	}

	int mxid = -1;
	int predmxid = -1;
	vector<int> anses(n);
	vector<int> cnts(graph[0].size());
	int mnus;
	for (int i = 0; i < que.size(); i++) {
		if (rlq.find(que[i].second) != rlq.end()) {
			mnus = 0;
			if (mxid == que[i].first) {
				if (predmxid != -1) mnus = cnts[predmxid];	
			}
			else {
				if (mxid != -1) mnus = cnts[mxid];
			}
			anses[que[i].second] = i + 1 - mnus;
		}
		cnts[que[i].first]++;
		if (mxid == -1 || cnts[que[i].first] > cnts[mxid]) {
			predmxid = mxid;
			mxid = que[i].first;
		}
		else if (que[i].first != mxid && (predmxid == -1 || cnts[que[i].first] > cnts[predmxid])) {
			predmxid = que[i].first;
		}
	}
	for (int x : qs) {
		cout << anses[x] << '\n';
	}
}
signed main() {
	int tt = 1;// cin >> tt;
	while (tt--)
		solve();
}
/*
7 1
1
2
3
1
5
6
0 1 3 5
2 4 6
7
*/
