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

using namespace std;

using ll = long long;

#pragma GCC optimaze("Ofast");

vector<vector<int>> gr;
vector<ll> s;

void dfs(int v, ll& su, ll x) {
	if (s[v] <= x) return;
	su++;
	for (int u : gr[v]) dfs(u, su, x);
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, q;
	cin >> n >> q;
	gr.resize(n);
	vector<int> p(n, -1);
	s.resize(n);
	for (int i = 1; i < n; i++) {
		int x;
		cin >> x;
		x--;
		p[i] = x;
		gr[x].push_back(i);
	}
	for (int i = 0; i < n; i++) cin >> s[i];
	set<pair<ll, int>> se;
	se.insert({ 0, 0 });
	vector<int> sz(n);
	vector<int> ma(n);
	vector<int> su(n);
	vector<pair<int, int>> mas(n, { 0, 0 });
	while (int(se.size())) {
		pair<int, ll> p2 = *se.begin();
		se.erase(p2);
		int v = p2.second;
		for (int u : gr[v]) {
			se.insert({ -s[u], u });
		}
		int V = v;
		int la = v;
		V = p[v];
		while (V != -1) {
			if (mas[V].first == sz[la]) ma[v] = max(ma[v], mas[V].second);
			else ma[v] = max(ma[v], mas[V].first);
			sz[la]++;
			if (sz[la] >= mas[V].first) {
				swap(mas[V].first, mas[V].second);
				mas[V].first = sz[la];
			}
			else if (sz[la] >= mas[V].second) {
				mas[V].second = sz[la];
			}
			la = V;
			V = p[V];
		}
		sz[0]++;
		su[v] = sz[0]-1;
	}


	while (q--) {
		int v;
		cin >> v;
		v--;
		cout << su[v] - ma[v] << " ";
	}
}



