#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 3e5 + 69;

vector<vector<int>> g;
bool vis[N];
int ans[N];
int s[N];
vector<vector<int>> gwas;
void dfs(int v, int tnow = 0) {
    ans[v] = tnow;
    vis[v] = true;
    pair<int, int> now = {-1, -1};
    for (int u : g[v]) {
        if (vis[u]) continue;
        now = max(now, {s[u], u});
    }
    if (now.second == -1) return;
    int newv = now.second;
    if (g[v].size() > g[newv].size()) swap(g[newv], g[v]);
    g[newv].reserve(g[v].size() + g[newv].size());
    for (int u : g[v]) {
        if (vis[u] || u == newv || u == v) continue;
        g[newv].push_back(u);
    }
    g[v].clear();
    dfs(newv, tnow + 1);
}

bitset<N> onway;
int ansdel = 0;
int dfs2(int v, int t, int par = -1) {
    if (ans[v] >= t) return 0;
    int now = 0;
    if (!onway[v]) now = 1;
    for (int u : g[v]) {
        if (u == par) continue;
        int other = dfs2(u, t, v);
        if (onway[v] && !onway[u]) ansdel = max(ansdel, other);
        now += other;
    }
    return now;
}

void solve() {
    int n, q;
    cin >> n >> q;
    vector<int> par(n);
    g.resize(n);
    for (int i = 1; i < n; ++i) {
        int v;
        cin >> v;
        --v;
        g[i].push_back(v);
        par[i] = v;
    }
    for (int i = 0; i < n; ++i) cin >> s[i];
    gwas = g;
    dfs(0);
    swap(g, gwas);
    while (q--) {
        int v;
        cin >> v;
        --v;
        onway.reset();
        int now = v;
        while (now) {
            onway[now] = true;
            now = par[now];
        }
        onway[0] = true;
        ansdel = 0;
        dfs2(0, ans[v]);
        cout << ans[v] - ansdel << " ";
    }
}

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