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

using namespace std;
using namespace __gnu_pbds;

auto seed = chrono::high_resolution_clock().now().time_since_epoch().count();
mt19937 rnd(seed);

template<typename T>
using orderet_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename V>
using table = gp_hash_table<T, V>;

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ld = long double;
using dd = double;

#define int ll

vector<vector<int>> g;
vector<int> cnt;
vector<int> p;

int mxx = 0;

int up(int v, int from){
    int ans = 0;
    if(v != 1) ans += up(p[v], v) + 1;
    for(auto to: g[v]){
        if(to == from) continue;
        ans += cnt[to];
        mxx = max(mxx, cnt[to]);
    }
    return ans;
}

void add(int v){
    cnt[v]++;
    if(v != 1) add(p[v]);
}

void solve(){
    int n, q;
    cin>>n>>q;
    g.assign(n+1, {});
    p.assign(n+1, 0);
    cnt.assign(n+1, 0);
    for(int v = 2; v <= n; ++v){
        cin>>p[v];
        g[p[v]].push_back(v);
    }
    vector<int> s(n+1);
    for(int i = 0; i < n; ++i) cin>>s[i+1];
    set<pair<int, int>> st;
    st.insert({-s[1], 1});
    vector<int> ans(n+1);
    while(!st.empty()){
        auto [v, i] = *st.begin();
        st.erase({v, i});
        mxx = 0;
        ans[i] = up(i, -1) - mxx;
        for(auto to: g[i]){
            st.insert({-s[to], to});
        }
        add(i);
    }
    while(q--){
        int v;
        cin>>v;
        cout << ans[v] << " ";
    }
}

signed main(){
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    //cin>>t;
    while(t--) solve();
}