//#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#pragma GCC target("avx2")
using namespace std;
using ll = int;
constexpr ll N = 3e5 + 1;
vector<ll> g[N];
ll s[N], tin[N], tout[N], d[N];

ll cnt[N][N];

ll timer = 0;

void Dfs(ll v, ll dph = 0) {
    tin[v] = timer++;
    d[v] = dph;
    for (auto &u : g[v]) {
        Dfs(u, dph + 1);
    }
    for (ll i = 0; i < s[v]; ++i) {
        cnt[v][i] = 1;
    }
    for (auto &u : g[v]) {
        for (ll i = 0; i < s[v]; ++i) {
            cnt[v][i] += cnt[u][i];
        }
    }
    tout[v] = timer++;
}

bool upper(ll a, ll b) {
    return tin[a] <= tin[b] && tout[a] >= tout[b];
}

void solve() {
    ll n, q;
    cin >> n >> q;
    vector<ll> p(n + 1, 0);
    for (ll i = 2; i <= n; ++i) {
        cin >> p[i];
        g[p[i]].push_back(i);
    }
    for (ll i = 1; i <= n; ++i) {
        cin >> s[i];
    }
    Dfs(1);

//    for (ll i = 1; i <= n; ++i) {
//        for (ll j = 0; j <= n; ++j) {
//            cout << cnt[i][j] << ' ';
//        }
//        cout << '\n';
//    }
    while (q --> 0) {
        ll u;
        cin >> u;
        ll mn = s[u], mx = 0, ans = 0, tmp = u;
        while (u != 0) {
            u = p[u];
            for (auto &e : g[u]) {
                if (!upper(e, tmp)) {
                    ans += cnt[e][mn];
                    mx = max(mx, cnt[e][mn]);
                }
            }
            if (u != 1) {
                mn = min(mn, s[u]);
            }
        }
        cout << ans - mx + d[tmp] << '\n';
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll t = 1;
//    cin >> t;
    while (t --> 0) {
        solve();
    }

    return 0;
}

