#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

vector<vector<ll>> g;
vector<ll> a;
vector<ll> pos;
vector<ll> dp;
vector<bool> par;
ll ans;

void dfs(ll v, ll x) {
    dp[v] = pos[v] < x;
    for (auto &to: g[v]) {
        dfs(to, x);
        dp[v] += dp[to];
    }
    if (!par[v]) {
        ans = max(ans, dp[v]);
    }
}

int main() {
#ifdef DEBUG_Q
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    ll n, q;
    cin >> n >> q;
    g.assign(n, {});
    vector<ll> p(n, -1);
    for (ll i = 1; i < n; i++) {
        cin >> p[i];
        p[i]--;
        g[p[i]].push_back(i);
    }
    a.assign(n, 0);
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
    }
    priority_queue<pair<ll, ll>, vector<pair<ll, ll>>> pq;
    pq.emplace(a[0], 0);
    vector<ll> gg;
    while (!pq.empty()) {
        ll v = pq.top().second;
        pq.pop();
        gg.push_back(v);
        for (auto &to: g[v]) {
            pq.emplace(a[to], to);
        }
    }
    pos.assign(n, 0);
    for (ll i = 0; i < n; i++) {
        pos[gg[i]] = i;
    }
    while (q--) {
        ll v;
        cin >> v;
        v--;
        dp.assign(n, 0);
        par.assign(n, false);
        ans = 0;
        for (ll i = v; i != -1; i = p[i]) {
            par[i] = true;
        }
        dfs(0, pos[v]);
        cout << pos[v] - ans << ' ';
    }
}
