#include <bits/stdc++.h>

using namespace std;

vector<vector<pair<int, int>>> g;
vector<int> par;
vector<int> s;
vector<int> ans;

signed main() {
    int n, q;
    cin >> n >> q;
    g.resize(n);
    par.resize(n);
    for (int i = 1; i < n; i++) {
        cin >> par[i];
        par[i]--;
    }
    s.resize(n);
    for (int i = 0; i < n; i++) cin >> s[i];
    for (int i = 1; i < n; i++) {
        g[par[i]].push_back({s[i], i});
    }
    for (int i = 0; i < n; i++) {
        sort(g[i].rbegin(), g[i].rend());
    }
    ans.resize(n);
    set<pair<int, int>> cu;
    cu.insert({s[0], 0});
    multiset<int> res;
    vector<int> b(n);
    int pos = 0;
    res.insert(0);
    while (!cu.empty()) {
        auto [w, v] = *(--cu.end());
        cu.erase(--cu.end());
        int u = par[v];
        while (u != 0) {
            res.erase(res.find(b[u]));
            u = par[u];
        }
        ans[v] = pos - *(--res.end());
        pos++;
        b[v] = 1;
        res.insert(1);
        u = par[v];
        while (u != 0) {
            b[u]++;
            res.insert(b[u]);
            u = par[u];
        }
        for (auto [ww, uu] : g[v]) {
            cu.insert({ww, uu});
        }
    }
    for (int i = 0; i < q; i++) {
        int x;
        cin >> x;
        x--;
        cout << ans[x] << " ";
    }
}
