#include <bits/extc++.h>

using namespace std;

struct dsu {
    vector<int> p;
    void init(int n) {
        p.assign(n, 0);
        iota(p.begin(), p.end(), 0);
    }
    int id(int x) {
        return x == p[x] ? x : p[x] = id(p[x]);
    }
    void unite(int x, int y) {
        p[id(x)] = id(y);
    }
};

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, q;
    cin >> n >> q;
    vector<int> kek(n, -1), to(n, -1), p(n), h(n);
    int z = 0;
    for (int i = 1; i < n; i++) {
        cin >> p[i], p[i]--;
    }
    vector<int> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    set<pair<int, int>> lol;
    for (int i = 1; i < n; i++) {
        h[i] = h[p[i]] + 1;
        if (p[i] == 0) {
            kek[i] = z++;
            lol.emplace(s[i], i);
        } else {
            to[p[i]] = i;
            kek[i] = kek[p[i]];
        }
    }
    multiset<int> suka;
    for (int i = 0; i < n; i++) {
        if (to[i] == -1) {
            suka.insert(0);
        }
    }
    vector<int> ans(n);
    int timer = 0;
    while (!lol.empty()) {
        timer++;
        auto [_, v] = *lol.rbegin();
        lol.erase(--lol.end());
        suka.extract(h[v] - 1);
        ans[v] = timer;
        if (!suka.empty()) {
            ans[v] -= *suka.rbegin();
        }
        if (to[v] != -1) {
            lol.emplace(s[to[v]], to[v]);
        }
        suka.insert(h[v]);
    }
    while (q--) {
        int v;
        cin >> v, v--;
        cout << ans[v] << '\n';
    }
    return 0;
}
