#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

struct pa{
    int v, x;
};

bool operator<(pa a, pa b)
{
    if(a.x == b.x) return a.v < b.v;
    return a.x > b.x;
}

const int inf = 1e9;

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, q;
    cin >> n >> q;
    vector<int> p(n);
    p[0] = 0;
    for(int i = 1; i < n; ++i){
        cin >> p[i];
        --p[i];
    }
    vector<int> s(n);
    for(int &x : s) cin >> x;
    s[0] = 0;
    vector<pa> a(n);
    for(int i = 0; i < n; ++i) a[i] = {i, s[i]};
    sort(a.begin(), a.end());
    vector<int> pp(n), sd(n), su(n), mu(n);
    vector<set<pa>> d(n);
    for(int i = 0; i < n - 1; ++i){
        int v = a[i].v, x = a[i].x;
        sd[v] += 1;
        int u = v;
        while(s[u] >= x){
            pa ch = {u, sd[u]};
            u = p[u];
            if(s[u] < x){
                su[v] = sd[u] + 1;
                pp[v] = u;
            }
            sd[u] += sd[v];
            if(u != p[v]){
                d[u].extract({ch.v, ch.x - sd[v]});
            }
            if(d[u].size() > 0){
                mu[v] = max(mu[v], (*d[u].begin()).x);
            }
            d[u].insert(ch);
        }
    }
    vector<int> ans;
    for(int i = 0; i < q; ++i){
        int v;
        cin >> v;
        --v;
        int sum = 0, maxx = 0;
        while(v != 0){
            sum += su[v];
            maxx = max(maxx, mu[v]);
            v = pp[v];
        }
        ans.push_back(sum - maxx);
    }
    for(int x : ans) cout << x << ' ';
    cout << endl;
}