#include <bits/stdc++.h>

using namespace std;

vector<vector<int>> r;
vector<int> s;
int c;
int u;
vector<int> p;

void dfs(int i, int pref)
{
    if(i==u){
        return;
    }
    ++c;
    for(int to: r[i]){
        if(to==pref){
            return;
        }
        if(s[to]<s[u]){
            return;
        }
        dfs(to, i);
    }
    for(int to: r[i]){
        if(to==pref){
            return;
        }
        if(s[to]<s[u]){
            return;
        }
        p[i]+=p[to]+1;
    }
}

int main()
{
    int n, q;
    cin>>n>>q;
    r.resize(n);
    s.resize(n);
    vector<int> ot(n);

    for(int i=1; i<n; ++i){
        int y;
        cin>>y;
        --y;
        ot[i]=y;
        r[y].push_back(i);
    }
    for(int i=0; i<n; ++i){
        cin>>s[i];
    }


    while(q--){
        cin>>u;
        --u;
        c=0;
        p.assign(n, 0);
        dfs(0, -1);

        vector<bool> w(n, 1);

        w[u]=0;
        w[0]=0;
        int j=u;
        while(ot[j]!=0){
            j=ot[j];
            w[j]=0;
        }


        int ans=c-1;

        for(int i=0; i<n; ++i){
            if(!w[i]){
                continue;
            }
            ans=min(ans, c-1-p[i]);
        }
        cout<<max(ans, 0)<<" ";
    }



    return 0;
}
