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

using namespace std;

#define int long long

const int maxn = 3e5 + 10;
vector<int> parent(maxn, 0);
vector<vector<int>> edges(maxn, vector<int>());
vector<int> cost(maxn, 0);
vector<int> when_get_usual(maxn, 0);
vector<int> ans(maxn, 0);
vector<int> cou(maxn, 0);
int n, q;

void make_usual() {
    int v = 1;
    set<pair<int, int>> all;
    int timee = 1;
    while (true) {
        when_get_usual[v] = timee;
        timee++;
        for (auto u : edges[v]) {
            all.insert({cost[u], u});
        }
        if (all.size() == 0) {
            break;
        }
        pair<int, int> some = *all.rbegin();
        v = some.second;
        all.erase({cost[v], v});
    }
}

void cou_lower(int v, int num, int need_v) {
    if (when_get_usual[v] > when_get_usual[need_v] && cost[v] <= num) {
        return;
    }
    for (auto u : edges[v]) {
        cou_lower(u, num, need_v);
        cou[v] += cou[u];
    }
    if (when_get_usual[v] > when_get_usual[need_v] && cost[v] > num) {
        cou[v]++;
    }
}

void clear_lower() {
    for (int i = 1; i <= n; i++) {
        cou[i] = 0;
    }
}


void dfs(int v) {
    if (v == 1) {
        ans[v] = 1;
    } else {
        cou_lower(1, cost[v], parent[v]);
        ans[v] = when_get_usual[v];
        ans[v] = max(ans[v], ans[parent[v]] + cou[1] + 1);
        int q = 0;
        for (int i = 1; i <= n; i++) {
            if (when_get_usual[i] > when_get_usual[parent[v]]) {
                q = max(q, cou[i]);
            }
        }
        ans[v] = min(ans[v], when_get_usual[parent[v]] + cou[1] - q + 1);
        clear_lower();
    }
    for (auto u : edges[v]) {
        dfs(u);
    }
}



signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(15);
    cin >> n >> q;
    for (int i = 2; i <= n; i++) {
        int p;
        cin >> p;
        parent[i] = p;
        edges[p].push_back(i);
    }
    for (int i = 1; i <= n; i++) {
        cin >> cost[i];
    }
    make_usual();
    dfs(1);
    for (int i = 0; i < q; i++) {
        int num;
        cin >> num;
        cout << ans[num] - 1 << endl;
    }
}
