#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#include <queue>

using namespace std;
using ll = long long;
using ld = long double;
mt19937 rd(328498234);
const ll INF = 1e18;

template<typename T>
struct node {
	int l, r;
	int sz, prior;
	T val;
	node(const T& v = T()) : val(v) {
		sz = 1;
		l = r = -1;
		prior = rd();
	}
};
vector<node<int>> dd;

int getsz(int v) {
	if (v == -1)
		return 0;
	return dd[v].sz;
}

void upd_node(int v) {
	if (v == -1)
		return;

	dd[v].sz = 1;
	if (dd[v].l != -1) {
		dd[v].sz += dd[dd[v].l].sz;
	}
	if (dd[v].r != -1) {
		dd[v].sz += dd[dd[v].r].sz;
	}
}

void push_node(int v) {
	return;
}

int merge(int l, int r) {
	if (l == -1)
		return r;
	if (r == -1)
		return l;
	push_node(l);
	push_node(r);
	if (dd[l].prior < dd[r].prior) {
		dd[r].l = merge(l, dd[r].l);
		upd_node(r);
		return r;
	}
	else {
		dd[l].r = merge(dd[l].r, r);
		upd_node(l);
		return l;
	}
}

pair<int, int> split_sz(int v, int k) { //{<=k, >k}
	if (v == -1)
		return { -1, -1 };
	if (dd[v].sz <= k)
		return { v, -1 };
	if (k <= 0)
		return { -1, v };
	push_node(v);
	if (getsz(dd[v].l) >= k) {
		auto p = split_sz(dd[v].l, k);
		dd[v].l = p.second;
		upd_node(v);
		return { p.first, v };
	}
	else {
		auto p = split_sz(dd[v].r, k - getsz(dd[v].l) - 1);
		dd[v].r = p.first;
		upd_node(v);
		return { v, p.second };
	}
}

pair<int, int> split_val(int v, int val) { // {<=val, >val}
	if (v == -1)
		return { -1, -1 };
	push_node(v);
	if (dd[v].val > val) {
		auto p = split_sz(dd[v].l, val);
		dd[v].l = p.second;
		upd_node(v);
		return { p.first, v };
	}
	else {
		auto p = split_sz(dd[v].r, val);
		dd[v].r = p.first;
		upd_node(v);
		return { v, p.second };
	}
}

int create_node(int val) {
	dd.push_back(val);
	return (int)dd.size() - 1;
}

struct segtree {
	struct node {
		int val;
		node(int val = 0) : val(val) {}
	};

	int sz;
	int ql, qr;
	vector<node> tr;
	vector<int> sizes;
	segtree(int n) {
		sz = 1;
		while (sz < n)
			sz <<= 1;
		tr.assign(sz * 2 - 1, node());
		sizes.assign(sz * 2 - 1, 0);
		sizes[0] = sz;
		for (int i = 1; i < sz * 2 - 1; i++)
			sizes[i] = sizes[(i - 1) / 2] / 2;
		ql = qr = -1;
	}

	void upd(int v) {
		tr[v].val = tr[v * 2 + 1].val + tr[v * 2 + 2].val;
		return;
	}
	void push(int v) {
		return;
	}

	void op_on_seg(int v, int l, int r) {
		if (qr <= l || r <= ql)
			return;
		if (ql <= l && r <= qr) {
			// op
			return;
		}
		push(v);
		op_on_seg(v * 2 + 1, l, (l + r) / 2);
		op_on_seg(v * 2 + 2, (l + r) / 2, r);
		upd(v);
	}

	void get_on_seg(int v, int l, int r) {
		if (qr <= l || r <= ql)
			return;
		if (ql <= l && r <= qr) {
			// get
			return;
		}
		push(v);
		get_on_seg(v * 2 + 1, l, (l + r) / 2);
		get_on_seg(v * 2 + 2, (l + r) / 2, r);
		// merge
		return;
	}
};

const int SZ = 3e5 + 1;
vector<int> g[SZ];
int pr[SZ];
int ans[SZ];
int s[SZ];
int cnt[SZ];
int ma1[SZ];
int ma2[SZ];

void upd(int v, int p = -1) {
	if (v == -1)
		return;
	cnt[v]++;
	if (p != -1 && ma1[v] != p) {
		if (ma2[v] != p) {
			if (ma1[v] == -1 || cnt[ma1[v]] < cnt[p])
				ma1[v] = p;
			else if (ma2[v] == -1 || cnt[ma2[v]] < cnt[p])
				ma2[v] = p;
		}
		else {
			if (cnt[ma1[v]] < cnt[ma2[v]])
				swap(ma1[v], ma2[v]);
		}
	}
	upd(pr[v], v);
}

int get_ans(int v, int p = -1) {
	if (v == -1)
		return 0;
	if (ma1[v] == p)
		return max(get_ans(pr[v], v), (ma2[v] == -1 ? 0 : cnt[ma2[v]]));
	return max(get_ans(pr[v], v), (ma1[v] == -1 ? 0 : cnt[ma1[v]]));
}

void solve() {
	int n, m;
	cin >> n >> m;
	pr[1] = -1;
	for (int i = 2; i <= n; i++) {
		cin >> pr[i];
		g[pr[i]].push_back(i);
	}
	for (int i = 1; i <= n; i++)
		cin >> s[i];
	vector<int> qu(n + 1, -1);
	vector<int> ans(m);
	for (int i = 0; i < m; i++) {
		int x;
		cin >> x;
		qu[x] = i;
	}

	set<pair<int, int>> st;
	st.insert({ -s[1], 1 });
	int cnt = 0;
	while (!st.empty()) {
		auto p = *st.begin();
		st.erase(st.begin());
		upd(p.second);
		if (qu[p.second] != -1)
			ans[qu[p.second]] = cnt - get_ans(p.second);
		for (auto u : g[p.second])
			st.insert({ -s[u], u });

		cnt++;
	}

	for (auto x : ans)
		cout << x << ' ';

	return;
}

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	solve();
}