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

#pragma GCC optimize("O3")
#define ll long long
#define vec vector
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x.size())
#define pii pair < int, int >
#define f first
#define s second

using namespace std;

template <typename T>
bool umn (T &a, T b) {return a > b ? (a = b, 1) : 0; }
template <typename T>
bool umx (T &a, T b) {return a < b ? (a = b, 1) : 0; }

const int N = 3e5;
const int oo = 2e9;
const ll OO = 1e18;
const int mod = 1e9 + 7;

int p[N], s[N];
vec < int > g[N];

int tt, t[N], c[N], res[N], cnt[N], siz[N], tin[N], h[N];

int seg[4 * N], push[4 * N];

void prop (int v, int l, int r) {
    seg[v] += push[v];
    if (l != r) {
        push[v << 1] += push[v];
        push[v << 1 | 1] += push[v];
    }
    push[v] = 0;
}

void update (int v, int l, int r, int ql, int qr, int x) {
    prop(v, l, r);
    if (l > qr || r < ql)
        return;
    if (l >= ql && r <= qr) {
        push[v] += x;
        prop(v, l, r);
        return;
    }
    int m = l + r >> 1;
    update(v << 1, l, m, ql, qr, x);
    update(v << 1 | 1, m + 1, r, ql, qr, x);
    seg[v] = max(seg[v << 1], seg[v << 1 | 1]);
}

int getmx () {
    return seg[1];
}

void update (int ql, int qr, int x) {
    update(1, 0, N - 1, ql, qr, x);
}

void dfs (int v) {
    siz[v] = 1;
    for (int i = 0; i < sz(g[v]); ++i) {
        int u = g[v][i];
        dfs(u);
        siz[v] += siz[u];
        if (siz[u] > siz[g[v][0]])
            swap(g[v][0], g[v][i]);
    }
}


void hld (int v) {
    if (h[v] == 0)
        h[v] = v;
    if (sz(g[v]))
        h[g[v][0]] = h[v];
    tin[v] = tt++;
    for (int u : g[v]) {
        hld(u);
    }
}

void update_path (int v, int x) {
    while (v) {
        update(tin[h[v]], tin[v], x);
        v = p[h[v]];
    }
}

void slv () {
    int n, q;
    cin >> n >> q;
    for (int i = 1; i < n; ++i) {
        cin >> p[i];
        --p[i];
        g[p[i]].push_back(i);
    }


    dfs(0);
    hld(0);
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }
    vec < int > ord;
    set < pii > setik;
    setik.insert({0, 0});
    while (sz(setik)) {
        int v = setik.begin()->s;
        setik.erase(setik.begin());
        ord.push_back(v);
        for (int u : g[v])
            setik.insert({-s[u], u});

    }

    priority_queue < int > st;
    int id = 0;
    for (int x : ord) {
        update_path(x, -oo);

        res[x] = id++ - getmx();
        update_path(x, oo + 1);
    }
    for (int i = 0, v; i < q; ++i) {
        cin >> v;
        cout << max(0, res[v - 1] - 0) << " ";
    }

}

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;
//    cin >> t;
    while (t--) {
        slv();
    }
}
