#include <bits/stdc++.h>
using namespace std;
#define int int64_t
void solve() {
    int n, q;
    cin >> n >> q;
    vector<int> g[n + 1];
    vector<bool> f(n + 1, false);
    vector<int> pp(n + 1, 0);
    vector<int> cnt(n + 1, 0);
    vector<int> ans(n + 1, 0);
    vector<int> s(n + 1);
    for (int i = 2; i <= n; i++) {
        int p;
        cin >> p;
        g[p].push_back(i);
        if (p == 1) {
            pp[i] = i;
        }
        else {
            pp[i] = pp[p];
        }
    }
    for (int i = 1; i <= n; i++) {
        cin >> s[i];
    }
    set<pair<int, int>> sg;
    for (auto to : g[1]) {
        sg.insert({s[to], to});
    }
    int cur = 0;
    int mx = 0, mx2 = 0;
    while (int(sg.size()) > 0) {
        auto it = sg.end();
        it--;
        sg.erase(it);
        int u = (*it).second;
        for (auto to : g[u]) {
            sg.insert({s[to], to});
        }
        cur++;
        cnt[pp[u]]++;
        if (cnt[pp[u]] > cnt[mx]) {
            mx2 = mx;
            mx = pp[u];
        }
        else if (cnt[pp[u]] > cnt[mx2]) {
            mx2 = pp[u];
        }
        if (mx != pp[u]) {
            ans[u] = cur - cnt[mx];
        }
        else {
            ans[u] = cur - cnt[mx2];
        }
    }
    for (int qq = 0; qq < q; qq++) {
        int v;
        cin >> v;
        cout << ans[v] << '\n';
    }
}
int32_t main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}
