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

using namespace std;

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

int dfs(int v, int x) {
	int cnt = 0;
	if (dp[v] < x) cnt++;
	for (auto to : g[v]) {
		cnt += dfs(to, x);
	}
	return cnt;
}

int main() {
	int n, q;
	cin >> n >> q;
	g.resize(n);
	vector<int> p(n);
	for (int i = 1; i < n; i++) {
		int v;
		cin >> v;
		v--;
		p[i] = 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 });
		}
	}
	while (q--) {
		int va;
		cin >> va;
		va--;
		int st = dp[va];
		vector<int> b;
		while (va != 0) {
			int prv = va;
			va = p[va];
			for (auto to : g[va]) {
				if (to == prv) continue;
				if (dp[to] < st) {
					b.push_back(to);
				}
			}
		}
		int max1 = 0;
		for (auto to : b) {
			max1 = max(max1, dfs(to, st));
		}
		cout << st - max1 << ' ';
	}
}