#include <bits/stdc++.h>
#pragma GCC optimize("O3")

using namespace std;
const int MAXN = 3e5 + 1;
vector<int> g[MAXN];
int parent[MAXN], s[MAXN], ans[MAXN], val[MAXN];
int cool_parent[MAXN];


void dfs(int u, int x) {
    if (u != x) cool_parent[u] = x;
    for (int v: g[u]) {
        dfs(v, x);
    }
}


int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, q;
    cin >> n >> q;
    for (int i = 2; i <= n; i++) {
        int p;
        cin >> p;
        parent[i] = p;
        g[p].push_back(i);
    }
    for (int i = 1; i <= n; i++) {
        ans[i] = MAXN;
        cin >> s[i];
    }
    for (int i = 1; i <= n; i++) {
        sort(g[i].begin(), g[i].end(), [&](int a, int b) {
            return s[a] < s[b];
        });
    }
    for (int v: g[1]) {
        dfs(v, v);
    }

    int timer = 0;
    set<pair<int, int>, greater<>> rm = {{0, 1}};
    multiset<int> vals;
    while (!rm.empty()) {
        auto [_, u] = *rm.begin();
        rm.erase(rm.begin());
        for (int v: g[u]) {
            rm.emplace(s[v], v);
        }

        int v = cool_parent[u];
        if (v > 1) {
            vals.erase(vals.find(val[v]));
        }
        ans[u] = timer;
        if (!vals.empty()) {
            ans[u] -= *vals.rbegin();
        }
        v = u;
        val[v]++;
        vals.insert(val[v]);
        v = cool_parent[v];
        if (v > 1) {
            val[v]++;
            vals.insert(val[v]);
        }
        timer++;
    }


    while (q--) {
        int v;
        cin >> v;
        cout << ans[v] << " ";
    }
    return 0;
}
