#include <bits/stdc++.h>

using namespace std;

vector<vector<pair<int, int>>> g;
vector<int> par;
vector<int> s;
vector<int> ans;
vector<int> tin;
vector<int> tout;
int tim = 0;

void dfs(int v) {
    tin[v] = tim;
    tim++;
    for (auto [w, u] : g[v]) {
        dfs(u);
    }
    tout[v] = tim;
    tim++;
}


signed main() {
    int n, q;
    cin >> n >> q;
    g.resize(n);
    par.resize(n);
    tin.resize(n);
    tout.resize(n);
    for (int i = 1; i < n; i++) {
        cin >> par[i];
        par[i]--;
    }
    par[0] = -1;
    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());
    }
    dfs(0);
    ans.resize(n);
    set<pair<int, int>> cu;
    cu.insert({s[0], 0});
    vector<int> t(q);
    vector<bool> need(n);
    for (int i = 0; i < q; i++) {
        cin >> t[i];
        need[t[i] - 1] = true;
    }
    vector<int> b(n);
    int pos = 0;
    while (!cu.empty()) {
        auto [w, v] = *(--cu.end());
        cu.erase(--cu.end());
        if (need[v]) {
            vector<int> c(n);
            int res = 0;
            for (int i = n - 1; i >= 0; i--) {
                c[i] = b[i];
                for (auto [ww, uu] : g[i]) {
                    c[i] += c[uu];
                }
                if (tin[i] <= tin[v] and tout[v] <= tout[i]) continue;
                res = max(res, c[i]);
            }
            ans[v] = pos - res;
        }
        b[v] = 1;
        pos++;
        for (auto [ww, uu] : g[v]) {
            cu.insert({ww, uu});
        }
    }
    for (int i = 0; i < q; i++) {
        int x = t[i];
        x--;
        cout << ans[x] << " ";
    }
}
