#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<functional>
#include<queue>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, q;
	cin >> n >> q;
	vector<vector<int>> g(n);
	vector<int> parent(n);
	parent[0] = -1;
	for (int i = 1; i < n; ++i) {
		int p;
		cin >> p;
		p--;
		parent[i] = p;
		g[p].push_back(i);
		g[i].push_back(p);
	}
	vector<int> sz(n);
	function<void(int)> dfs = [&](int v) {
		sz[v] = 1;
		for (auto u : g[v]) {
			if (u != parent[v]) {
				dfs(u);
				sz[v] += sz[u];
			}
		}
	};
	dfs(0);
	vector<int> s(n);
	for (int i = 0; i < n; ++i) {
		cin >> s[i];
	}
	//vector<int> ans(n, 1e9);
	//ans[0] = 0;
	//priority_queue<pair<int, int>> Q;
	//int x = 0;
	//for (auto i : g[0]) {
	//	swap(s[i], x);
	//	Q.emplace(s[0], 0);
	//	vector<int> visited(n);
	//	int cnt = 0;
	//	while (!Q.empty()) {
	//		int r = Q.top().second; Q.pop();
	//		visited[r] = 1;
	//		ans[r] = min(ans[r], cnt);			
	//		for (auto u : g[r]) {
	//			if (!visited[u]) {
	//				Q.emplace(s[u], u);
	//			}
	//		}
	//		cnt++;
	//	}
	//	swap(s[i], x);
	//}
	vector<int> ans(n, 1e9);
	ans[0] = 0;
	priority_queue<pair<int, int>> Q;
	Q.emplace(s[0], 0);
	vector<int> visited(n);
	int cnt = 0;
	while (!Q.empty()) {
		int r = Q.top().second; Q.pop();
		visited[r] = 1;
		ans[r] = min(ans[r], cnt);			
		for (auto u : g[r]) {
			if (!visited[u]) {
				Q.emplace(s[u], u);
			}
		}
		cnt++;
	}
	vector<vector<pair<int, int>>> mx(n);
	for (int i = 0; i < n; ++i) {
		for (auto u : g[i]) {
			if (u != parent[i]) {
				mx[i].emplace_back(s[u], sz[i]);
			}
		}
		sort(mx[i].begin(), mx[i].end());
	}
	for (int i = 0; i < q; ++i) {
		int v;
		cin >> v;
		v--;
		int as = ans[v];
		int last = s[v];
		int mx = 0;
		while (v != 0) {
			v = parent[v];
			for (auto u : g[v]) {
				if (u != parent[v] && s[u] > s[v]) {
					mx = max(mx, ans[u] - ans[v] - 1);
				}
			}
			last = s[v];
		}
		cout << as - mx << '\n';
	}
	return 0;
}