#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;

using ll = long long;

void solve() {
    ll n, m;
    cin >> n >> m;
    vector <ll> a(n, 0), x(m);
    for (int i = 0; i < m; ++i) {
        cin >> x[i];
    }
    multiset <ll> s;
    for (auto i : a) {
        s.insert(i);
    }
    //cout << x[0] << ' ';
    for (int i = 0; i < m; ++i) {
        /*if (i > 0)
            cout << x[i] - x[i - 1] << ' ';*/
        ll t1 = *s.begin(), t2 = *(--s.end());
        if (t2 - x[i] > x[i] - t1 && i != m - 1) {
            s.extract(t2);
            t2 = x[i] - t2;
            s.insert(t2);
         } else {
            s.erase(s.begin());
            t1 = x[i] - t1;
            s.insert(t1);
        }
        /*for (auto j : s) {
            cout << j << ' ';
        }
        cout << '\n';*/
    }
    ll ans = 0;
    for (auto i : s) {
        //cout << i << ' ';
        ans += i;
    }
    cout << '\n';
    cout << ans;
}

void solve1() {
    ll n, m;
    cin >> n >> m;
    vector <ll> a(n, 0), x(m);
    for (int i = 0; i < m; ++i) {
        cin >> x[i];
    }
    ll ans = -1e18;
    for (int i = 0; i < (1 << m); ++i) {
        a.assign(n, 0);
        for (int j = 0; j < m; ++j) {
            if (i & (1 << j)) {
                a[1] = x[j] - a[1];
            } else {
                a[0] = x[j] - a[0];
            }
        }
        ans = max(ans, a[0] + a[1]);
    }
    cout << ans;
}

vector <vector <ll>> gr, dp;
vector <ll> x, s, tin, tout;
vector <bool> used;
ll timer = 0;

void dfs(ll v) {
    used[v] = true;
    x[v] = min(x[v], s[v]);
    tin[v] = timer++;
    for (auto u : gr[v]) {
        if (!used[u]) {
            if (v != 0) {
                x[u] = x[v];
            }
            dfs(u);
            for (int i = 0; i <= gr.size(); ++i) {
                dp[v][i] += dp[u][i];
            }
        }
    }
    for (int i = 0; i <= x[v]; ++i) {
        dp[v][i]++;
    }
    tout[v] = timer++;
}

bool anc(ll v, ll u) {
    return tin[v] <= tin[u] && tout[v] >= tout[u];
}

void solve2() {
    ll n, q;
    cin >> n >> q;
    vector <ll> p(n, -1);
    gr.resize(n), used.resize(n), dp.resize(n, vector <ll>(n + 2)), x.resize(n, 1e18), s.resize(n);
    for (int i = 1; i < n; ++i) {
        ll v;
        cin >> v;
        v--;
        p[i] = v;
        gr[v].emplace_back(i);
        gr[i].emplace_back(v);
    }
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }
    tin.resize(n), tout.resize(n);
    dfs(0);
    /*for (int i = 0; i < n; ++i) {
        for (int j = 0; j <= n; ++j) {
            cout << dp[i][j] << ' ';
        }
        cout << '\n';
    }*/
    for (int i = 0; i < q; ++i) {
        ll v;
        cin >> v;
        v--;
        if (v == 0) {
            cout << 0 << '\n';
            continue;
        }
        ll ans = 0, mx = 0;
        for (auto u : gr[0]) {
            if (!anc(u, v)) {
                mx = max(mx, dp[u][x[v]]);
                ans += dp[u][x[v]];
            } else {
                ans += dp[u][x[v]] - dp[v][x[v]];
            }
        }
        if (p[v] != 0) {
            for (auto u: gr[p[v]]) {
                if (u != v && u != p[p[v]]) {
                    ans -= dp[u][x[v]];
                    mx = max(mx, dp[u][s[v] + 1]);
                    ans += dp[u][s[v] + 1];
                }
            }
        }
        //cout << ans << ' ' << mx << ' ';
        cout << ans - mx + 1 << '\n';
    }
}

/*7 6
1 2 3 1 5 6
4 3 5 7 2 6 1
2 3 4 5 6 7*/

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll tt = 1;
    //cin >> tt;
    while (tt--) {
        solve2();
        cout << endl;
    }
}
