#include <bits/stdc++.h>

using namespace std;

void solve();

//#pragma GCC optimize("O3","Ofast","fastmath","unroll-loops")
//#pragma GCC target("avx2","sse4.2","bmi","lzcnt","popcnt")
int main() {
#ifdef LOCAL
    freopen("input.txt","r",stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

#define int long long
#define endl '\n'
const int N=3e5+10,INF=2e18,MOD=1e9+7;
vector<int> gr[N];

int tin[N],tout[N],timer=0;
bool used[N];
int par[N];
int cnt[N];
void dfs(int v){
    tin[v]=timer++;
    for(auto to:gr[v]){
        par[to]=v;
        dfs(to);
    }
    tout[v]=timer++;
}
void dfs2(int v){
    cnt[v]=used[v];
    for(auto to:gr[v]){
        dfs2(to);
        cnt[v]+=cnt[to];
    }
}
bool upper(int f,int s){
    return tin[f]<=tin[s] && tout[f]>=tout[s];
}
void solve(){
    int n,q;
    cin>>n>>q;
    for(int i=1;i<n;i++){
        int p;
        cin>>p;
        p--;
        gr[p].push_back(i);
    }
    vector<int> ans(n,0),val(n,0);
    dfs(0);
    par[0]=-1;
    vector<int> s(n);
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    set<pair<int,int>> st;
    st.insert({-s[0],0});
    int cur=0;
    vector<int> ord(n);
    unordered_map<int,int> pos;
    while(!st.empty()){
        int v=st.begin()->second;
        st.erase(st.begin());
        ord[cur]=v;
        pos[v]=cur;
        for(auto to:gr[v]){
            st.insert({-s[to],to});
        }
        cur++;
    }
    if(n>=1e5)assert(0);
    for(int i=0;i<q;i++){
        int v;
        cin>>v;
        v--;
        fill(used,used+n,false);
        fill(cnt,cnt+n,0);
        for(int j=0;j<pos[v];j++){
            used[ord[j]]=true;
        }
        dfs2(0);
        int mx=0;
        for(int j=0;j<n;j++){
            if(!upper(j,v)){
                mx=max(mx,cnt[j]);
            }
        }
        cout<<pos[v]-mx<<" ";
    }cout<<endl;
}