#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <algorithm>
#include <cmath>
#include <map>
#include <iomanip>
#include <queue>
#include <unordered_map>
using namespace std;
using ll = long long;
vector<vector<ll>> gr;
vector<ll> s;
ll dfs(vector<ll>& val, vector<bool> &path, ll v, ll c) {
	if (c > s[v])
		return 0;
	val[v]++;
	for (auto& to : gr[v]) {
		if (path[to]) continue;
		ll x = dfs(val, path, to, c);
		val[v] += x;
	}
	return val[v];
}

void solve() {
	ll n, q;
	cin >> n >> q;
	vector<ll> p(n, -1),h(n);
	s.resize(n); gr.resize(n);
	for (ll i = 1; i < n; ++i) {
		cin >> p[i];
		--p[i];
		gr[p[i]].push_back(i);
		h[i] = h[p[i]] + 1;	
	}
	for (ll i = 0; i < n; ++i)
		cin >> s[i];
	for (ll i = 0; i < q; ++i) {
		ll u;
		cin >> u;
		--u;
		vector<bool> path(n);
		vector<ll> val(n);
		ll ans = h[u], cost = s[u];
		path[u] = true;
		u = p[u];
		ll sum = 0, mx = 0;
		while (u != -1) {
			for(auto &to : gr[u]) 
				if(!path[to])
					dfs(val, path, to, cost);
			path[u] = true;
			cost = min(cost, s[u]);
			u = p[u];
		}
		for (ll j = 0; j < n; ++j) {
			if (path[j]) continue;
			sum += val[j];
			mx = max(mx, val[j]);
		}
		cout << sum - mx + ans << " ";
	}
}

int main() {
#ifdef _DEBUG
	freopen("input2.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false); cin.tie(0);
	ll t = 1;
	// cin >> t;
	while (t--)
		solve();
}