#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const ll N = 3e5 + 5;

ll p[N];
vector<ll> g[N];
ll s[N];
ll nd[N];
ll ans[N];

ll dp[N], de[N];

ll mx = 0;
ll fk[N];
ll jopa[N];

multiset<ll> e;
void dfs(ll v, ll op) {
   fk[v] = op;
   for(ll u: g[v]) {
       dfs(u, op);
   }
}


void solve() {
    ll n, q;
    cin >> n >> q;
    for (int i = 2; i <= n; ++i) {
        cin >> p[i];
        g[p[i]].push_back(i);
    }
    for (int i = 1; i <= n; ++i) {
        cin >> s[i];
    }
    vector<ll> z(q);
    for (int i = 0; i < q; ++i) {
        cin >> z[i];
        nd[z[i]] = 1;
    }
    for(ll u: g[1]) {
        dfs(u, u);
    }
    priority_queue<pair<ll, ll>> qp;
    qp.push({s[1], 1});
    ll cnt = 0;
    ll sum = 0;
    while (!qp.empty()) {
        ll v = qp.top().second;
        qp.pop();
        if (jopa[fk[v]] != 0) {
            e.erase(e.find(jopa[fk[v]]));
        }
        if (nd[v]) {
            mx = 0;
            if (!e.empty()) {
                mx = *(--e.end());
            }
            ans[v] = cnt - mx;
        }
        sum++;
        if (v != 1) {
            jopa[fk[v]]++;
            e.insert(jopa[fk[v]]);
        }
        cnt++;
        de[v] = 1;
        for (ll u: g[v]) {
            qp.push({s[u], u});
        }
    }
    for (int i = 0; i < q; ++i) {
        cout << ans[z[i]] << " ";
    }
}

int main() {
    int test = 1;
    // cin >> test;
    while (test--) {
        solve();
    }
}
