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

using namespace std;
using namespace __gnu_pbds;

#define int long long
using oset = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 3e5, inf = 1e9;

vector<vector<int>> g(N + 1);
set<pair<int, int>> c[N + 1];
int s[N + 1], gl[N + 1];
vector<pair<int, int>> z[N + 1];
int ans[N + 1], mn[N + 1];

void dfs(int v, int p){
    gl[v] = 1;
    int mx = 0, v1 = -1;
    for(auto u : g[v]){
        dfs(u, v);
        if(mx < c[u].size()){
            mx = c[u].size();
            v1 = u;
        }
        gl[v] += gl[u];
    }
    if(v1 != -1){
        swap(c[v1], c[v]);
    }
    for(auto u : g[v]){
        if(v1 != u){
            for(auto u1 : c[u]){
                c[v].insert(u1);
            }
        }
    }
    int sz = 0;
    while(!c[v].empty() and c[v].rbegin()->first >= s[v]){
        sz += c[v].rbegin()->second;
        c[v].erase(--c[v].end());
    }
    c[v].insert({s[v], sz + 1});
    for(auto [mx, i] : z[v]){
        int k = 0;
        for(auto [x, sz] : c[v]){
            if(mx < x){
                break;
            }
            k += sz;
        }
        ans[i] += (gl[v] - k);
        mn[i] = max(mn[v], gl[v] - k);
    }
}

int32_t main()
{
    int n, q;
    cin >> n >> q;
    int p[n + 1];
    for(int i = 2;i <= n;i++){
        cin >> p[i];
        g[p[i]].push_back(i);
    }
    for(int i = 1;i <= n;i++){
        cin >> s[i];
    }
    for(int i = 1, x;i <= q;i++){
        cin >> x;
        if(x == 1) continue;
        int v = x, mx = inf, dl = 0;
        do{
            dl++;
            mx = min(mx, s[v]);
            int v1 = v;
            v = p[v];
            for(auto u : g[v]){
                if(u != v1){
                    z[u].push_back({mx, i});
                }
            }
        }while(v != 1);
        ans[i] += dl;
    }
    dfs(1, -1);
    for(int i = 1;i <= q;i++){
        cout << ans[i] - mn[i] << " ";
    }

    return 0;
}
