#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <fstream>
#include <algorithm>
#include <queue>

using ll = long long;
#define endl '\n'
#pragma GCC target("avx,avx2,fma")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unrool-loops")

using namespace std;

//const int N = 100000 + 1, mod = 1e9 + 7;
int n, m, k, q, N, M;
int st = 1;

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

vector<int> h;
vector<int> sz;
vector<bool> used;

vector<vector<int>> cl; int ii;
void subdfs(int v, int pr, int x) {
    x = min(s[v], x);
    cl[ii].push_back(x);
    for (auto u : g[v]) if (u != pr) subdfs(u, v, x);
}
void dfs3(int v, int pr) {
    for (auto x : g[v]) {
        if (x == pr)continue;
        for (auto u : g[v]) {
            if (u == pr || u == x) continue;
            mxt[x] = max(mxt[x], (int)(cl[u].end() - lower_bound(cl[u].begin(), cl[u].end(), s[x])));
            ii++;
        }
    }
}


int xx;
void dfs4(int v, int pr, int yy) {
    for (auto u : g[v]) {
        if (u != pr && u != p[v]) {
            ii++;
            mxt[xx] = max(mxt[xx], (int)(cl[u].end() - lower_bound(cl[u].begin(), cl[u].end(), yy)));
        }
    }
    if (p[v] >= 0) dfs4(p[v], v, min(yy, s[v]));
}



void solve() {
	cin >> n >> q;
	tt.assign(n, 0); mxt.assign(n, 0);
	h.resize(n, 0);
	sz.resize(n);
	used.assign(n, false);
	g.resize(n);
	p.assign(n, -1);
	for (int i = 1; i < n; i++) {
		cin >> p[i]; p[i]--;
		g[p[i]].push_back(i);
		g[i].push_back(p[i]);
	}
	s.resize(n);
	for (auto& x : s) cin >> x;
    
	priority_queue<pair<int, int>> qq;
	qq.push({ s[0], 0 });
	int timer = 0;
	while (!qq.empty()) {
		int v = qq.top().second; qq.pop();
		tt[v] = timer++;
		for (auto u : g[v]) {
			if (u != p[v] && u != n) qq.push({ s[u], u });
		}
	}
    cl.resize(n);
    for (int i= 0; i < n; i++) {
        ii = i; subdfs(i, p[i], 1e9);
    }

	while (q--) {
		int v; cin >> v; --v;
        dfs3(v, p[v]);xx = v;
        if (p[v] >= 0) dfs4(p[v], v, s[v]);
        cout << tt[v] - mxt[v] << ' ';
	}
}

#define LOCAL
signed main() {
	ios_base::sync_with_stdio(false);
	cout.tie(0);
	cin.tie(0);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	int t = 1;  //cin >> t;
	while (t--) {
		solve();
	}
}