#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<unordered_set>
#include<unordered_map>
#include<iomanip>
#include<random>
#include<bitset>
#include<ctime>

#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2")

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using uint = unsigned int;

ll gcd(ll a, ll b) {
	return b == 0 ? a : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
mt19937 mt(time(0));
const int N = 3e5 + 2, inf = 1e9 + 100, mod = 1e9 + 7, mod2 = 998244353, P = 257;
const ll llinf = 1e18 + 100;
struct fenwick {
	int t[N];
	fenwick() {
		fill(t, t + N, 0);
	}
	void upd(int i) {
		for (++i; i < N; i += (i & -i)) t[i]++;
	}
	int get(int l, int r) {
		int s = 0;
		for (; l; l -= (l & -l)) s -= t[l];
		for (; r; r -= (r & -r)) s += t[r];
		return s;
	}
};
struct segtree {
	int t[N * 2];
	segtree() {
		fill(t, t + N * 2, 0);
	}
	void upd(int v, int l, int r, int i, int val) {
		t[v] = max(t[v], val);
		if (r - l == 1) return;
		int m = (l + r) >> 1;
		if (i < m) upd(v + 1, l, m, i, val);
		else
			upd(v + 2 * (m - l), m, r, i, val);
	}
	void upd(int i, int val) {
		upd(0, 0, N, i, val);
	}
	int get(int v, int l, int r, int ql, int qr) {
		if (r <= ql || qr <= l) return 0;
		if (ql <= l && r <= qr) return t[v];
		int m = (l + r) >> 1;
		return max(get(v + 1, l, m, ql, qr), get(v + 2 * (m - l), m, r, ql, qr));
	}
	int get(int l, int r) {
		return get(0, 0, N, l, r);
	}
};
fenwick f;
segtree t;
int n, q, qu[N], p[N], path[N], ind[N], tin[N], tout[N], sz[N], a[N], ans[N], timer = 0;
vector<int> g[N];
void dfs1(int v) {
	sz[v] = 1;
	for (int i = 0; i < g[v].size(); ++i) {
		int to = g[v][i];
		dfs1(to);
		sz[v] += sz[to];
		if (sz[to] > sz[g[v][0]]) swap(g[v][0], g[v][i]);
	}
}
void dfs2(int v, int p) {
	ind[timer] = v;
	tin[v] = timer++;
	path[v] = p;
	for (auto to : g[v]) {
		dfs2(to, to == g[v][0] ? p : to);
	}
	tout[v] = timer;
}
void add(int v) {
	f.upd(tin[v]);
	while (v != -1) {
		v = path[v];
		if (v == 0) return;
		t.upd(p[v], f.get(tin[v], tout[v]));
		v = p[v];
	}
}
int get(int v) {
	int ans = 0;
	while (v != -1) {
		int u = path[v];
		ans = max(ans, t.get(tin[u], tin[v] + 1));
		if (tin[v] != n - 1 && path[ind[tin[v] + 1]] == u) {
			int to = ind[tin[v] + 1];
			ans = max(ans, f.get(tin[to], tout[to]));
		}
		v = p[u];
	}
	return ans;
}

void solve() {
	cin >> n >> q;
	p[0] = -1;
	for (int i = 1; i < n; ++i) {
		cin >> p[i];
		--p[i];
		g[p[i]].push_back(i);
	}
	for (int i = 0; i < n; ++i) cin >> a[i];
	fill(qu, qu + n, -1);
	for (int i = 0; i < q; ++i) {
		int v;
		cin >> v;
		qu[--v] = i;
	}
	dfs1(0);
	dfs2(0, 0);
	priority_queue<pair<int, int>> pq;
	pq.push({ a[0], 0 });
	int cnt = 0;
	while (!pq.empty()) {
		int v = pq.top().second;
		pq.pop();
		if (qu[v] != -1) ans[qu[v]] = cnt - get(v);
		add(v);
		for (auto to : g[v]) {
			pq.push({ a[to], to });
		}
		++cnt;
	}
	for (int i = 0; i < q; ++i) cout << ans[i] << ' ';
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int tt = 1;
	//cin >> tt;
	while (tt--) {
		solve();
		cout << '\n';
		cout.flush();
	}
	return 0;
}