#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
mt19937 rnd(time(NULL));
#define int long long
vector<set<pair<int, int>>>graph;
vector<int>c; int cnt = 0;
set<pair<int, int>>del; vector<int>num;
void ans(int start){
    num[start] = cnt;
    pair<int, int>val = {-1, -1};
    if(!graph[start].empty()) val = *(--graph[start].end());
    if(!del.empty()) val = max(val, *(--del.end()));
    if(val.second == -1) return;
    for(auto v: graph[start]) del.insert(v);
    del.erase(val); cnt++; ans(val.second);
}
vector<int>sz;
void dfs(int start, int less){
    if(num[start] < less) sz[start]++;
    for(auto val: graph[start]){
        dfs(val.second, less);sz[start] += sz[val.second];
    }
    if(num[start] == less) sz[start] -= 1e9;
}
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, q; cin >> n >> q; num.resize(n);
    vector<int>p(n); graph.resize(n); c.resize(n);
    for(int i = 0; i < n - 1; i++){
        cin >> p[i];
    }
    for(int i = 0; i < n; i++) cin >> c[i];
    for(int i = 0; i < n - 1; i++){
        graph[p[i] - 1].insert({c[i], i + 1});
    }
    ans(0);
    while(q--){
        int v; cin >> v; v--;
        sz.assign(n, 0); dfs(0, num[v]);
        int mx = 0; for(auto val: sz) mx = max(mx, val);
        if(mx >= 0)
            cout << num[v] - mx << " ";
    }
    return 0;
}