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

#define int long long

using namespace std;

int32_t main() {
	int n, q;
	cin >> n >> q;
	vector<vector<int>>g(n);
	vector<int>p(n);
	for (int i = 1; i < n; ++i) {
		int x;
		cin >> x;
		x--;
		p[i] = x;
		g[x].push_back(i);
	}
	vector<int>s(n);
	for (int i = 0; i < n; ++i) {
		cin >> s[i];
	}
	vector<int>v;
	vector<int>ind(n);
	set<pair<int, int>>lol;
	lol.insert({ -s[0],0 });
	for (int i = 0; i < n; ++i) {
		int u = lol.begin()->second;
		lol.erase(lol.begin());
		ind[u] = i;
		v.push_back(u);
		for (int x : g[u]) {
			lol.insert({ -s[x],x });
		}
	}
	vector<int>cnt(n);
	for (; q > 0; --q) {
		int x;
		cin >> x;
		x--;
		int lol = ind[x];
		int opa = 0;
		for (int i = lol; i >= 0; --i) {
			if (v[i] == x) {
				x = p[x];
			}
			else {
				cnt[v[i]] = 1;
				for (int x : g[v[i]]) {
					if (ind[x] < lol) {
						cnt[v[i]] +=cnt[x];
					}
				}
				opa = max(opa, cnt[v[i]]);
			}
		}
		cout << lol - opa << ' ';
	}
	return 0;
}