#include <bits/stdc++.h>
using namespace std;

struct segtree {
    segtree *L, *R;
    int l, r, mx, lz;
    segtree(int lb, int rb) {
        l = lb; r = rb; mx = 0; lz = 0;
        if (l == r) return;
        L = new segtree(l, (l + r) / 2);
        R = new segtree((l + r) / 2 + 1, r);
    };

    void push() {
        mx += lz;
        if (l != r) {
            L -> lz += lz;
            R -> lz += lz;
        }
        lz = 0;
    }

    void add(int lb, int rb, int x) {
        push();
        if (l > rb || r < lb) return;
        if (lb <= l && r <= rb) {
            lz += x;
            push();
            return;
        }
        L -> add(lb, rb, x);
        R -> add(lb, rb, x);
        mx = max(L -> mx, R -> mx);
    }

    int get() {
        return mx;
    }
};


main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, q;
    cin >> n >> q;
    vector < vector < int > > G(n);
    vector < int > p(n); p[0] = -1;
    for (int i = 1; i < n; i++) {
        cin >> p[i]; p[i]--;
        G[p[i]].push_back(i);
    }
    vector < int > s(n);
    for (int i = 0; i < n; i++) cin >> s[i];

    int T = 0;
    vector < int > val(n), ans(n);
    priority_queue < pair < int , int > > pq;
    pq.push({s[0], 0});
    vector < int > A;
    while (!pq.empty()) {
        int v = pq.top().second; pq.pop();
        val[v] = T++;
        A.push_back(v);
        for (auto u : G[v]) pq.push({s[u], u});
    }

    vector < int > sz(n), tin(n), tout(n), head(n);
    function < void(int) > sizes = [&](int v) {
        sz[v] = 1;
        for (auto &u : G[v]) {
            sizes(u);
            sz[v] += sz[u];
            if (sz[u] > sz[G[v][0]]) swap(u, G[v][0]);
        }
    };
    T = -1;
    function < void(int) > hld = [&](int v) {
        tin[v] = ++T;
        for (auto u : G[v]) {
            head[u] = (u == G[v][0] ? head[v] : u);
            hld(u);
        }
        tout[v] = T;
    };
    sizes(0);
    head[0] = 0;
    hld(0);

    segtree *tree = new segtree(0, T);
    function < void(int, int) > add = [&](int v, int x) {
        while (v != -1) {
            tree -> add(tin[head[v]], tin[v], x);
            v = p[head[v]];
        }
    };

    vector < int > cnt(n);
    for (auto v : A) {
        add(v, -1e9);
        int mx = tree -> get();
        mx = max(mx, 0);
        ans[v] = val[v] - mx;
        add(v, 1e9 + 1);
    }




    while (q--) {
        int v;
        cin >> v; v--;
        cout << ans[v] << ' ';
    }
    cout << '\n';
}
