#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;
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];
int boss[maxn];

void dfs(int u, int b){
    tin[u] = timer++;
    boss[u] = b;
    for (auto v : g[u]){
        if (u == 0) dfs(v, v);
        else dfs(v, b);
    }
    tout[u] = timer++;
}

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

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

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

int qq[maxn], good[maxn];

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



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