#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

#define int long long
const int oo = 1e18;

int n, q;

struct SegmentTree {
	struct Node {
		int mn = 0;
		int toadd = 0;

		void add(int x) {
			mn += x;
			toadd += x;
		}

		Node() {}

		Node(int x) {
			mn = x;
		}
	};

	vector <Node> t;
	int n;

	SegmentTree(int n) {
		this->n = n;
		t.resize(4 * n);
	}

	SegmentTree(vector <int>& a) {
		n = a.size();
		t.resize(4 * n);
		build(0, 0, n, a);
	}

	Node merge(int v) {
		Node res(max(t[v * 2 + 1].mn, t[v * 2 + 2].mn));
		return res;
	}

	void push(int v) {
		t[v * 2 + 1].add(t[v].toadd);
		t[v * 2 + 2].add(t[v].toadd);
		t[v].toadd = 0;
	}

	Node merge(Node l, Node r) {
		Node res(max(l.mn, r.mn));
		return res;
	}

	void build(int v, int l, int r, vector <int>& a) {
		if (l + 1 == r) {
			t[v] = Node(a[v]);
			return;
		}
		int m = (l + r) / 2;
		build(v * 2 + 1, l, m, a);
		build(v * 2 + 2, m, r, a);
		t[v] = merge(v);
	}

	void add(int v, int l, int r, int ql, int qr, int x) {
		if (qr <= l || r <= ql) return;
		if (ql <= l && r <= qr) {
			t[v].add(x);
			return;
		}
		push(v);
		int m = (l + r) / 2;
		add(v * 2 + 1, l, m, ql, qr, x);
		add(v * 2 + 2, m, r, ql, qr, x);
		t[v] = merge(v);
	}

	void add(int ql, int qr, int x) {
		add(0, 0, n, ql, qr, x);
	}

	Node get(int v, int l, int r, int ql, int qr) {
		if (qr <= l || r <= ql) return Node();
		if (ql <= l && r <= qr) return t[v];
		push(v);
		int m = (l + r) / 2;
		return merge(
			get(v * 2 + 1, l, m, ql, qr),
			get(v * 2 + 2, m, r, ql, qr)
		);
	}

	Node get(int ql, int qr) {
		return get(0, 0, n, ql, qr);
	}

	SegmentTree() {}
};

vector <int> p;
vector <int> s;
vector <vector <int>> g;

vector <vector <int>> vqs;
vector <int> answer;

vector <int> sz;

void precalc(int v) {
	sz[v] = 1;
	for (auto u : g[v]) {
		precalc(u);
		sz[v] += sz[u];
	}
	sort(g[v].begin(), g[v].end(), [&](int a, int b) {
		return sz[a] > sz[b];
		});
}

vector <int> h;
vector <int> tin, tout;
int T;

bool ispar(int p, int a) {
	return tin[p] <= tin[a] && tout[a] <= tout[p];
}

void build_hld(int v, int head) {
	tin[v] = T++;
	h[v] = head;
	for (auto u : g[v]) {
		if (u == g[v][0]) {
			build_hld(u, head);
		}
		else {
			build_hld(u, u);
		}
	}
	tout[v] = T;
}

SegmentTree dero;
vector <int> a;

void rootpath_add(int v) {
	while (v) {
		a[v]++;
		v = p[v];
	}
	a[v]++;
}

int calc_curr(int v) {
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (!ispar(i, v)) {
			ans = max(ans, a[i]);
		}
	}
	return ans;
}

set <pair <int, int>> st;

void ebfs() {
	int v = st.begin()->second;
	st.erase(st.begin());
	T++;
	rootpath_add(v);
	if (vqs[v].size()) {
		int curr = T - calc_curr(v);
		for (auto i : vqs[v]) {
			answer[i] = curr;
		}
	}
	for (auto u : g[v]) {
		st.insert({ -s[u], u });
	}
}

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

	cin >> n >> q;
	p.resize(n);
	g.resize(n);
	for (int i = 1; i < n; i++) {
		cin >> p[i];
		p[i]--;
		g[p[i]].push_back(i);
	}
	s.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	vqs.resize(n);
	for (int i = 0; i < q; i++) {
		int v;
		cin >> v;
		v--;
		vqs[v].push_back(i);
	}
	answer.resize(q);
	sz.resize(n);
	h.resize(n);
	tin.resize(n);
	tout.resize(n);
	dero = SegmentTree(n);
	T = 0;
	precalc(0);
	build_hld(0, 0);
	T = -1;
	st.insert({ 0, 0 });
	a.resize(n);
	while (st.size()) {
		ebfs();
	}
	T = 0;
	for (auto ans : answer) {
		cout << ans << ' ';
	}
}