#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
using ll = long long;
using ld = long double;

template<typename T>
struct SparseTableMin {
	vector<vector<T>> sparse;
	vector<int> logs;
	void init(vector<T> &arr) {
		int n = (int)arr.size();
		logs.assign(n + 1, 0);
		for (int i = 2; i <= n; ++i) {
			logs[i] = logs[i >> 1] + 1;
		}
		sparse.resize(logs[n] + 1, vector<T>(n));
		sparse[0] = arr;
		for (int k = 0; k + 1 <= logs[n]; ++k) {
			for (int i = 0; i + (1 << k) < n; ++i) {
				sparse[k + 1][i] = std::min(sparse[k][i], sparse[k][i + (1 << k)]);
			}
		}
	}
	T min(int l, int r) {
		int sz = logs[r - l + 1];
		return std::min(sparse[sz][l], sparse[sz][r - (1 << sz) + 1]);
	}
};

struct FastLca {
	vector<int> tin;
	SparseTableMin<pair<int, int>> st;
	void init(const vector<vector<int>> &g, int root = 0) {
		int n = (int)g.size();
		tin.resize(n);
		int timer = 0;
		vector<pair<int, int>> euler_tour;
		auto dfs = [&](auto &&dfs, int v, int pr = -1) -> void {
			tin[v] = timer++;
			euler_tour.emplace_back(tin[v], v);
			for (int to : g[v]) {
				if (to == pr) continue;
				dfs(dfs, to, v);
			}
		};
		dfs(dfs, root);
		st.init(euler_tour);
	}
	int lca(int u, int v) {
		if (tin[u] > tin[v]) swap(u, v);
		return st.min(tin[u], tin[v]).second;
	}
};

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0);

	int n, q;
	cin >> n >> q;
	vector<int> anc(n), s(n), v(q);
	vector<vector<int>> g(n);
	for (int i = 1; i < n; ++i) {
		cin >> anc[i]; anc[i]--;
		g[anc[i]].push_back(i);
	}
	for (int i = 0; i < n; ++i) {
		cin >> s[i];
		s[i]--;
		s[i] = n - 1 - s[i];
	}
	vector<int> ans(n), depth(n);
	vector<int> tin(n), tout(n);
	int timer = 0;
	auto dfs = [&](auto &&dfs, int v) -> void {
		tin[v] = timer++;
		for (int to : g[v]) {
			depth[to] = depth[v] + 1;
			dfs(dfs, to);
		}
		tout[v] = timer++;
	};
	auto is_anc = [&](int u, int v) -> bool {
		return tin[u] <= tin[v] && tout[v] <= tout[u];
	};
	FastLca st_lca;
	st_lca.init(g);
	dfs(dfs, 0);

	for (int tt = 0; tt < q; ++tt) {
		int i;
		cin >> i;
		i--;
		if (i == 0) {
			cout << 0 << '\n';
			continue;
		}
		int temp = 0;
		vector<int> dp(n);
		vector<int> check(n);
		int cur = i;
		int num = s[i];
		auto dfs1 = [&](auto &&dfs1, int v, int val = 0) -> void {
			val = std::max(val, s[v]);
			check[v] = val < num;
			for (int to : g[v]) {
				dfs1(dfs1, to, val);
			}
		};
		while (cur > 0) {
			int p_cur = cur;
			cur = anc[cur];
			for (int to : g[cur]) {
				if (to == p_cur) continue;
				dfs1(dfs1, to);
			}
			num = std::max(num, s[cur]);
		}
		auto dfs = [&](auto &&dfs, int v) -> void {
			dp[v] = check[v];
			for (int to : g[v]) {
				dfs(dfs, to);
				dp[v] += dp[to];
			}
		};
		dfs(dfs, 0);
		int j = i;
		while (j > 0) {
			int last_v = j;
			j = anc[j];
			for (int to : g[j]) {
				if (to == last_v) continue;
				temp = std::max(temp, dp[to]);
			}
		}
		int cnt = 0;
		for (int j = 0; j < n; ++j) {
			if (is_anc(j, i)) {
				continue;
			}
			if (check[j]) {
				cnt++;
			}
		}
		cout << depth[i] + cnt - temp << '\n';
	}

}
