#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 lg = 19;
const int N = 3e5;
pii up[lg][N];
vector<int> g[N];
int par[N];
int s[N], invs[N];
int cl[N];
int dep[N];
int tin[N], tout[N];
int max_win[N];
int t[N];

int timer;

void dfs0(int v) {
	tin[v] = timer++;
	for (int u : g[v])
		dfs0(u);
	tout[v] = timer;
}

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

int get_min(int v, int u) {
	int mn = 1e9;
	int k = dep[v] - dep[u];
	for (int i = lg - 1; i > -1; i--)
		if ((k >> i) & 1) {
			mn = min(mn, up[i][v].second);
			v = up[i][v].first;
		}
	return mn;
}

int min_path[N];
vector<int> ord[N];
int sz[N];

struct pq_pro_max {
	priority_queue<int> q, del;

	pq_pro_max() {}

	void push(int v) {
		q.push(v);
	}

	void erase(int v) {
		del.push(v);
	}

	void flush() {
		while (!del.empty() && q.top() == del.top())
			q.pop(), del.pop();
	}

	bool empty() {
		flush();
		return q.empty();
	}

	int top() {
		flush();
		return q.top();
	}
};

pq_pro_max acts[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;
		dep[i] = dep[p] + 1;
	}
	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;
	dfs0(0);
	for (int v = 0; v < n; v++) {
		up[0][v].first = v ? par[v] : 0;
		up[0][v].second = s[v];
	}
	for (int i = 1; i < lg; i++)
		for (int j = 0; j < n; j++) {
			int tmp = up[i - 1][j].first;
			up[i][j].first = up[i - 1][tmp].first;
			up[i][j].second = min(up[i - 1][j].second, up[i - 1][tmp].second);
		}
	for (int v = 1; v < n; v++) {
		cl[v] = v;
		while (s[cl[v]] >= s[v])
			cl[v] = par[cl[v]];
		min_path[v] = get_min(v, cl[v]);
		ord[min_path[v]].push_back(v);
	}
	for (int vs = n - 1; vs > -1; vs--) {
		int v = invs[vs];
		sz[v]++;
		int cur_push = sz[v];
		for (int u = v; u; u = par[u]) {
			int p = par[u];
			if (s[u] < vs)
				break;
			if (u != v)
				acts[p].erase(sz[u]);
		}
		for (int u = v; u; u = par[u]) {
			int p = par[u];
			if (s[u] < vs)
				break;
			acts[p].push(sz[u]);
			sz[p] += cur_push;
		}
		for (int u : ord[vs]) {
			t[u] = sz[cl[u]] - sz[u] + 1;
			for (int tmp = u; tmp != cl[u]; tmp = par[tmp]) {
				int p = par[tmp];
				acts[p].erase(sz[tmp]);
				if (!acts[p].empty())
					max_win[u] = max(max_win[u], acts[p].top());
				acts[p].push(sz[tmp]);
			}
		}
	}
	for (int v = 1; v < n; v++)
		t[v] += t[cl[v]], max_win[v] = max(max_win[v], max_win[cl[v]]);
	while (q--) {
		int v;
		cin >> v;
		v--;
		cout << t[v] - max_win[v] << ' ';
	}
	cout << '\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;
}
