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

#pragma GCC optimize("O3")

using namespace std;
//using namespace __gnu_pbds;

mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());

#define int long long

//typedef tree<int, null_type,less<int>,  rb_tree_tag, tree_order_statistics_node_update> ordered_set;

signed main(){
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#ifdef YA_KRUTOI
    freopen("input.txt", "r", stdin);
#endif
    int n, q;
    cin>>n>>q;
    vector<vector<int> > g(n);
    for(int i = 1; i < n; ++i){
        int p; cin>>p;
        g[--p].push_back(i);
    }
    vector<int> s(n);
    for(auto &x:s) cin>>x;

    auto solve = [&](int vq) -> void{
        vector<pair<int,int> > b;
        for(int i = 1; i < n; ++i){
            b.push_back(make_pair(s[i], i));
        }
        sort(b.rbegin(), b.rend());
        vector<int> ord = {0};
        for(auto &[l,r]:b) ord.push_back(r);
        vector<vector<int> > dp(n, vector<int>(2, n));
        dp[0][0] = 0;
        dp[0][1] = 0;
        for(int i = 1; i < n; ++i){
            dp[i][0] = dp[i-1][0] + 1;
            dp[i][1] = dp[i-1][1] + 1;
            if (i >= 2){
                dp[i][1] = min(dp[i][1], dp[i-2][0] + 1);
            }
        }
        for(int i = 0; i < n; ++i){
            if (ord[i] == vq-1){
                cout<<min(dp[i][0], dp[i][1])<<' ';
                return;
            }
        }
    };

    while(q--){
        int v;
        cin>>v;
        solve(v);
    }
    return 0;
}
