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

using namespace std;

vector<vector<int>> g;
vector<int> dp;

void dfs(int v, vector<int>& a) {
	a.push_back(dp[v]);
	for (auto to : g[v]) {
		dfs(to, a);
	}
}

int main(){
	int n, q;
	cin >> n >> q;
	g.resize(n);
	vector<int> S(n);
	for (int i = 1; i < n; i++) {
		int v;
		cin >> v;
		v--;
		g[v].push_back(i);
	}
	vector<int> s(n);
	for (int i = 0; i < n; i++) { cin >> s[i]; s[i] = -s[i]; }
	set<pair<int, int>> s1;
	s1.insert({ s[0], 0 });
	//vector<int> dp(n);
	dp.resize(n);
	int curr = 0;
	while (!s1.empty()) {
		int v = s1.begin()->second;
		dp[v] = curr;
		curr++;
		s1.erase(s1.begin());
		for (auto to : g[v]) {
			s1.insert({ s[to], to });
		}
	}
	int cnt = 0;
	vector<vector<int>> d(g[0].size());
	for (auto to : g[0]) {
		vector<int> aa;
		dfs(to, aa);
		d[cnt] = aa;
		cnt++;
	}
	for (int i = 0; i < d.size(); i++) {
		sort(d[i].begin(), d[i].end());
	}
	while (q--) {
		int va;
		cin >> va;
		va--;
		int c = dp[va];
		int max1 = 0;
		for (int i = 0; i < d.size(); i++){
			int l = -1;
			int r = d[i].size();
			while (r - l > 1) {
				int mid = (r + l) / 2;
				if (d[i][mid] >= c) {
					r = mid;
				}
				else {
					l = mid;
				}
			}
			if (r != d[i].size()) {
				if (d[i][r] == c) continue;
			}
			max1 = max(max1, l + 1);
		}
		cout << c - max1 << '\n';
	}
}