#pragma GCC optimize("O3", "unroll-loops")

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

#pragma GCC target("avx2")

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ost = tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;
template<long long N, class T = long long>
using pii = array<T, N>;

constexpr ll mxn = 3e5;//3e5;

ll n;
ll ans[mxn];
vector<ll> arr[mxn];
ost prl[mxn];
ll srt[mxn];

ll bp[1][mxn];

ll sz[mxn];

//pr[i] = bp[0][i];

void ddfs(const ll& v = 0) {
    sz[v] = 1;
    for (const auto& t : arr[v]) {
        ddfs(t);
        sz[v] += sz[t];
    }
}

ll fmx(const ll& v, const ll& vl, const ll& nx) {
    ll mx = 0;
    for (const auto& t : arr[v]) {
        if (t == nx) break;
        mx = max(mx, ll(arr[t].size() - prl[t].order_of_key(vl)));
    }
    if (bp[0][v] == v) return mx;
    return max(mx, fmx(bp[0][v], min(vl, srt[v]), v));
}

void dfs(const ll& v = 0, ll stp = 1) {
    cerr << "enter dfs v = " << v << endl;

    for (const auto& t : arr[v]) {
        ll kt = fmx(bp[0][t], srt[v], t);
        cerr << "fmt = " << kt << endl;
        ans[t] = stp - kt;
        dfs(t, stp + 1);
        stp += prl[t].size() - prl[t].order_of_key(srt[v]);

        if (prl[t].size() > prl[v].size()) swap(prl[t], prl[v]);
        for (const auto& tt : prl[t]) prl[v].insert(tt);
    }
}

int main() {
    //ost tt;
    //tt.insert(5);
    //tt.insert(10);
    //cout << tt.order_of_key(9);
    //cout << *tt.find_by_order(1);

    ll q;
    cin >> n >> q;
    for (ll i = 1; i < n; ++i) {
        ll t;
        cin >> t;
        --t;
        bp[0][i] = t;
        //arr[i].push_back(t);
        arr[t].push_back(i);
    }
    for (ll i = 0; i < n; ++i) {
        cin >> srt[i];
        prl[i].insert(srt[i]);
    }

    for (ll i = 0; i < n; ++i)
        sort(arr[i].begin(), arr[i].end(), [](const ll& t, const ll& tt){
         return srt[t] > srt[tt];
         });
    ddfs();
    dfs();

    while (q--) {
        ll t;
        cin >> t;
        cout << ans[t - 1] << ' ';
    }

    return 0;
}
