#include <bits/extc++.h>
using namespace std;
vector <set <pair <int, int> > > g;
vector <pair <int, int> > gt;
vector <int> s2;
vector <int> euler, lvl, pred, sz;
int seg_sz = 1,  N;
map <pair <int, int>, bool > have;
struct Segtree{
    vector <int> t;
    Segtree(){
        while (seg_sz <= N){
            seg_sz *= 2;
        }
        t.resize(seg_sz * 2 - 1, 0);
    }
    int get(int ql, int qr, int v= 0, int l = 0, int r = N){
        if (ql <= l && r <= qr){
            return t[v];
        }
        if (r <= ql || qr <= l){
            return 0;
        }
        int m = (r + l)/ 2;
        return max(get(ql, qr, 2 * v + 1, l, m), get(ql, qr, 2 * v + 2, m, r));
    }
    void update(int pos, int x, int v = 0, int l = 0, int r = N){
        if (l + 1 == r){
            t[v] = max(t[v], x);
            return;
        }
        int m = (r + l) / 2;
        if (pos < m) update(pos, x, 2 * v + 1,l ,m);
        else update(pos, x, 2 * v + 2, m, r);
        t[v] = max(t[2 * v + 1], t[2 * v + 2]);
    }
};
signed main(){
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, q;
    cin>>n>>q;
    N = n;
    Segtree tree;
    vector <int> p(n);
    s2.resize(n);
    g.resize(n);
    lvl.resize(n, 0);
    pred.resize(n, -1);
    sz.resize(n, 1);
    for (int i = 1; i < n; i++){
        cin>>p[i];
        p[i]--;
        pred[i] = p[i];
        lvl[i] = lvl[p[i]] + 1;
    }
    for (int i = 0; i < n; i++){
        cin>>s2[i];
        s2[i] *= -1;
    }
    for (int i = 1; i < n; i++){
        g[p[i]].insert({s2[i], i});
        have[{p[i], i}] = true;
    }
    int u = 0,  cnt = 1;
    vector <int> ans(n, 1e9);
    ans[0] = 0;
    map <int, int> bruh;
    for (int it = 0; it < q; it++){
        cin>>u;
        u--;
        bruh[u] = it;
    }
    u = 0;
    for (int i = 0; i < n - 1; i++){
        int v = g[u].begin()->second;
        euler.push_back(v);
        g[u].erase({s2[v], v});
        if (g[v].size() > g[u].size()){
            swap(g[v], g[u]);
        }
        for (auto& x: g[u]){
            g[v].insert(x);
        }
        u = v;
        if (ans[u] == 1e9)
        ans[u] = cnt;
        cnt++;
    }
    int s = 0;
    cnt = 0;
    vector <bool> used(n, false);
    euler.push_back(euler.back());
    for (int i = 0; i < euler.size(); i++){
        if (!used[s]){
            int check = tree.get(0,n + 1);
            ans[s] -= check;
            used[s] = true;
        }
        while (!have[{s, euler[i]}] && pred[s] != -1){
            gt.emplace_back(s, pred[s]);
            
            sz[pred[s]] += sz[s];
            tree.update(lvl[s], sz[s]);
            s = pred[s];
        }
        gt.emplace_back(s, euler[i]);
        s = euler[i];
        cnt++;
    }
    vector <int> res(q);
    for (auto& [k,v]: bruh){
        res[v] = ans[k];
    }
    for (int i = 0; i < q; i++){
        cout<<res[i]<<" ";
    }    
}