#pragma GCC optimize("O3, unroll_loops")
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#define int long long

using namespace std;

const int INF = 2e15;

vector <int> tin, tout;
int tim = 0;

void dfs(int v, int p, vector <multiset <int>> &g, vector <int>& brr, vector <int>& sum) {
	tin[v] = tim++;
	for (auto u : g[v]) {
		if (u != p) {
			dfs(u, v, g, brr, sum);
			sum[v] += sum[u];
		}
	}
	sum[v] += brr[v];
	tout[v] = tim++;
}

bool isPrev(int p, int v) {
	return tin[p] <= tin[v] && tout[v] <= tout[p];
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, q;
	cin >> n >> q;
	vector <int> p(n, -1);
	vector <multiset<int>> g(n);
	for (int i = 1; i < n; i++) {
		cin >> p[i];
		p[i]--;
		g[i].insert(p[i]);
		g[p[i]].insert(i);
	}
	vector <int> arr(n);
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	for (int _ = 0; _ < q; _++) {
		int v;
		cin >> v;
		v--;
		vector <int> que;
		set <pair<int, int>> st;
		st.insert({ -arr[0], 0 });
		while (!st.empty()) {
			int v = st.begin()->second;
			que.push_back(v);
			st.erase({ -arr[v], v });
			for (auto el : g[v]) {
				st.insert({ -arr[el], el });
				g[el].erase(v);
			}
		}
		vector <int> brr(n, 0);
		int ans = 0;
		for (int i = 0; i < n; i++) {
			if (que[i] == v) {
				ans = i;
				break;
			}
			brr[que[i]] = 1;
		}
		tin.assign(n, 0);
		tout.assign(n, 0);
		vector <int> sum(n, 0);
		dfs(0, -1, g, brr, sum);
		int maxi = 0;
		for (int i = 0; i < n; i++) {
			if (!isPrev(i, v)) {
				maxi = max(maxi, sum[i]);
			}
		}
		ans -= maxi;
		cout << ans << ' ';
	}
}
