
#include <iostream>
#include <limits>
#include <chrono>
#include <random>
#include <iomanip>
#include <algorithm>
#include <chrono>
#include <random>
#include <math.h>
#include <set>
using namespace std;
const int maxn = 3e5 + 1;
int t = 0;
int tin[maxn], tout[maxn], min_v[maxn],sz[maxn];
vector <int> g[maxn];
void dfs(int u ) {
	sz[u] = 1;
	for (auto el : g[u]) {
		dfs(el);
		sz[u] += sz[el];
	}
}
void dfs1(int u, int cnt_bad_up, int maxx_dell_up, vector <int>& ans,vector <int> &w) {
	int max_now = maxx_dell_up;
	int cnt_up_now = cnt_bad_up;
	for (int i = g[u].size() - 1;i >= 0;i--) {
		ans[g[u][i]] = cnt_up_now - max_now;
		dfs1(g[u][i],cnt_up_now + 1,max_now,ans,w);
		max_now = max(max_now, sz[g[u][i]]);
		cnt_up_now += sz[g[u][i]];
	}
}
signed main()
{
	int n, q;
	cin >> n >> q;
	vector <int> p(n, -1);
	for (int i = 1;i < n;i++) {
		int pi;
		cin >> pi;
		pi--;
		p[i] = pi;
		g[pi].push_back(i);
	}
	vector <int> w(n);
	for (int i = 0;i < n;i++) {
		cin >> w[i];
	}
	dfs(0);
	for (int i = 0;i < n;i++) {
		sort(g[i].begin(), g[i].end(), [w](int a, int b) {
			return w[a] < w[b];
			});
	}
	vector <int> ans(n,1e10);
	dfs1(0, 0, 0, ans, w);
	while (q--) {
		int vert;
		cin >> vert;
		vert--;
		cout << ans[vert] << "\n";
	}
}
