#ifdef _DEBUG
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <limits>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <numeric>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <chrono>
#include <random>
#include <assert.h>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
using ld = long double;
using pii = pair<int, int>;
using pli = pair<long long, int>;
using pil = pair<int, long long>;
using pll = pair<long long, long long>;
template <typename T>
using uset = unordered_set<T>;
template <typename T1, typename T2>
using umap = unordered_map<T1, T2>;

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

const int N = 3e5;
vector<int> g[N];
int par[N];
int s[N], invs[N];
int cl[N];
int max_win[N];
int t[N];
int leader[N];
int dep[N];
int min_path[N];

int sz[N], pr[N];

int get(int a) {
	return pr[a] = (pr[a] == a ? a : get(pr[a]));
}

bool unite(int a, int b) { // link a to b
	a = get(a);
	b = get(b);
	if (a == b)
		return false;
	pr[a] = b;
	sz[b] += sz[a];
	return true;
}

vector<int> ord[N];

inline void solve() {
	int n, q;
	cin >> n >> q;
	for (int i = 1; i < n; i++) {
		int p;
		cin >> p;
		p--;
		g[p].push_back(i);
		par[i] = p;
	}
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		s[i]--;
	}
	{
		int x = s[0];
		s[0] = 0;
		for (int i = 1; i < n; i++)
			if (s[i] < x)
				s[i]++;
	}
	for (int v = 0; v < n; v++)
		invs[s[v]] = v;
	for (int v = 1; v < n; v++) {
		if (par[v] == 0)
			leader[v] = v, min_path[v] = s[v];
		else
			leader[v] = leader[par[v]], min_path[v] = min(min_path[par[v]], s[v]);
		ord[min_path[v]].push_back(v);
		dep[v] = dep[par[v]] + 1;
	}
	for (int i = 0; i < n; i++) {
		pr[i] = i;
		sz[i] = 1;
	}
	multiset<int> chains;
	int connected = 0;
	for (int vs = n - 1; vs > 0; vs--) {
		int v = invs[vs];
		int old = sz[leader[v]];
		if (!g[v].empty()) {
			int u = g[v][0];
			if (s[u] >= vs)
				unite(u, v);
		}
		if (s[par[v]] >= vs)
			unite(v, par[v]);
		if (v == leader[v]) {
			connected += sz[v];
			chains.insert(sz[v]);
		} else {
			int top = get(v);
			if (top == leader[v]) {
				chains.erase(chains.find(old));
				connected -= old;
				chains.insert(sz[leader[v]]);
				connected += sz[leader[v]];
			}
		}
		for (int u : ord[vs]) {
			t[u] = connected - sz[leader[u]] + dep[u];
			chains.erase(chains.find(sz[leader[u]]));
			if (!chains.empty())
				max_win[u] = *(--chains.end());
			chains.insert(sz[leader[u]]);
		}
	}
	while (q--) {
		int v;
		cin >> v;
		v--;
		cout << t[v] - max_win[v] << '\n';
	}
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
#ifdef _DEBUG
	freopen("01.dat", "r", stdin);
#endif
	int tt = 1;
#ifdef _DEBUG
	cin >> tt;
#endif
	for (int test_id = 1; test_id <= tt; test_id++) {
#ifdef _DEBUG
		cout << "TESTCASE# " << test_id << '\n';
#endif
		solve();
	}
	return 0;
}
