#include <bits/stdc++.h>
#define pb push_back
#define endl "\n"
// #define pb push_back
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")

const int maxn = 3e5 + 10;
vector<int> g[maxn];
int p[maxn];
int s[maxn];
int ans[maxn];
int cnt[maxn];

struct cmp{
    bool operator()(const int &u, const int &v) const{
        return s[u] > s[v];
    }
};

struct cmp1{
    bool operator()(const int &u, const int &v) const{
        if (cnt[u] != cnt[v]) return cnt[u] > cnt[v];
        return u < v;
    }
};

set<int, cmp1> pos;
int timer = 0;
int tin[maxn], tout[maxn];

void dfs(int u){
    tin[u] = timer++;
    for (auto v : g[u]){
        dfs(v);
    }
    tout[u] = timer++;
}

bool is_pr(int u, int v){
    return tin[u] < tin[v] && tout[u] > tout[v];
}


int get_ans(int u){
    for (auto v : pos){
        if (is_pr(v, u)) continue;
        return cnt[v];
    }
    return 0;
}

void upd(int u){
    while (u != 0){
        pos.erase(u);
        cnt[u]++;
        pos.insert(u);
        u = p[u];
    }
}


void solve(){
    int n, q;
    cin >> n >> q;
    for (int i = 1; i < n; ++i){
        int pr;
        cin >> pr;
        pr--;
        g[pr].pb(i);
        p[i] = pr;
    }
    dfs(0);
    for (int i = 0; i < n; ++i){
        cin >> s[i];
    }
    set<int, cmp> now;
    now.insert((ll)0);
//    for (int u = 0; u < n; ++u){
//        pos.insert(u);
//    }
    pos.insert(0);
    int now_cnt = 0;
    while (!now.empty()){
        int u = *now.begin();
        now.erase(u);
        pos.insert(u);
        for (auto v : g[u]) {
            now.insert(v);
        }
        // get_ans
        ans[u] = now_cnt - get_ans(u);
        // upd
        upd(u);
        ++now_cnt;
    }
    while (q--){
        int v;
        cin >> v;
        v--;
        cout << ans[v] << " ";
    }
}



signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t = 1;
    // cin >> t;
    while (t--){
        solve();
    }
}