#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#include <map>
using namespace std;

#define ll long long
#define ull unsigned long long
#define db double
#define str string
#define vc vector
#define its(a) (a).begin(), (a).end()
#define itsr(a) (a).rbegin(), (a).rend()
#define tstr(a) to_string((a))
#define INF ((ll)1e18)

void solve() {
    ll n, q; cin >> n >> q;
    vc<vc<ll>> g(n);
    vc<ll> pr(n, -1);
    for (int i = 1;i < n ;++i) {
        ll u; cin >> u;
        --u;
        pr[i] = u;
        g[u].push_back(i);
    }
    

    vc<ll> s(n);
    for (auto& i : s) cin >> i;
    
    vc<pair<ll, ll>> v;
    for (int i = 0;i < n;++i) v.push_back({ s[i], i });
    sort(itsr(v));
    vc<ll> used(n);
    vc<ll> trs(n);
    trs[0] = used[0] = 1;
    
    vc<ll> tr(4 * n);

    auto rsq = [&](auto rsq, int v, int l, int r, int el, ll x) -> void {
        if (r - l == 1) {
            tr[v] += x;
            return;
        }
        int mid = (r + l) >> 1;
        if (el < mid)
            rsq(rsq, 2 * v + 1, l, mid, el, x);
        else rsq(rsq, 2 * v + 2, mid, r, el, x);
        tr[v] = max(tr[2 * v + 1], tr[2 * v + 2]);
    };
    rsq(rsq, 0, 0, n, 0, 1);
    vc<ll> ans(n);
    ll crs = 0;
    for (auto [cs, u] : v) {
        if (u == 0) continue;
        ++crs;
        ll v = u;
        while (v != -1) {
            used[v] = 1;
            rsq(rsq, 0, 0, n, v, -1e6);
            v = pr[v];
        }
        if (tr[0] > 0) {
            ans[u] = crs - tr[0];
        }
        else ans[u] = crs;
        v = u;
        while (v != -1) {
            used[v] = 1;
            rsq(rsq, 0, 0, n, v, 1e6+1);
            v = pr[v];
        }
    }

    for (int i = 0;i < q;++i) {
        ll u; cin >> u;
        cout << ans[u - 1] << " ";
    }
    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll _t = 1;
    //cin >> _t;
    while (_t--)
        solve();
}
