#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll = long long;
using ld = long double;
template <typename t>
ostream& operator<<(ostream& out, const vector<t> &v){
    for(auto x: v)out<<x<<" ";
    return out;
}
template <typename t>
istream& operator>>(istream& in,  vector<t> &v){
    for(auto &x: v)in>>x;
    return in;
}
template <typename t, typename u>
ostream& operator<<(ostream& out, const pair<t, u> p){
    out<<p.first<<" "<<p.second<<"\n";
    return out;
}
template <typename t, typename u>
istream& operator>>(istream& in,  pair<t, u> &p){
    in>>p.first>>p.second;
    return in;
}
__int128_t one = 1;
vector<ll> val, dp, tin, tout, go;
vector<vector<ll>> g;
ll cnt = 0, ans = 0;
bool is_anc(ll par, ll son){
    return tin[par]<=tin[son]&&tout[son]<=tout[par];
}
void dfs(ll v, ll cur, ll base){
    //cout<<v<<" "<<cur<<"\n";
    assert(v!=base);
        cnt++;
        dp[v]++;
    for(auto to: g[v]){
        if((is_anc(v, base)&&(val[to]>val[go[v]]||val[to]>val[base]))||(val[to]>val[cur]&&to!=base)||(is_anc(to, base)&&to!=base)){
            if(is_anc(v, cur)&&!is_anc(to, cur)){
                cur = go[v];
            }
            dfs(to, cur, base);
            dp[v]+=dp[to];
        }
    }
    if(!is_anc(v, cur))ans = max(ans, dp[v]);
}
ll tim = 0;
void dfsb(ll v){
    tin[v]=tim++;
    for(auto to: g[v])dfsb(to);
    tout[v]=tim++;
}
void solve () {
    ll n, q;
    cin>>n>>q;
    vector<ll> par(n);
    val.resize(n);
    g.resize(n);
    tin.resize(n);
    tout.resize(n);
    par[0]=-1;
    for(int i = 1; i<n; i++){
        cin>>par[i];
        par[i]--;
        g[par[i]].push_back(i);
    }
    cin>>val;
    dfsb(0);
    while(q--){
        ll cur;
        cin>>cur;
        if(cur==1){
            cout<<0<<"\n";
            continue;
        }
        go.resize(n);
        dp.assign(n, 0);
        ll cur1 = cur-1;
        while(par[cur1]!=-1){
            go[par[cur1]]=cur1;
            cur1 = par[cur1];
        }
        cnt = ans = 0;
        dfs(0, 0, cur-1);
        //cout<<cnt<<" "<<ans<<"\n";
        cout<<cnt-ans<<"\n";
    }
}
signed main () {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout<<fixed<<setprecision(18);
    ll AnyaSamsonovaGoSex = 1;
    while(AnyaSamsonovaGoSex--) solve();
}