#include <bits/stdc++.h>

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
template<class T> using ordered_set = tree<T, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;

//#pragma GCC target("avx,avx2")

const int mod = int(1e9) + 7, lg = 20;
const ll inf = ll(2e18) + 36;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

vector<vector<int>> g;
vector<int> p, a, sz, tin;

struct SegTree {
    int n;
    vector<int> t, p;

    void push(int v, int l, int r) {
        if (!p[v]) return;
        if (r - l > 1) {
            p[v * 2 + 1] += p[v];
            p[v * 2 + 2] += p[v];
        }
        t[v] += p[v];
        p[v] = 0;
    }

    void add(int v, int l, int r, int ql, int qr) {
        push(v, l, r);
        if (qr <= l || r <= ql) {
            return;
        }
        if (ql <= l && r <= qr) {
            p[v]++;
            push(v, l, r);
            return;
        }
        int m = (l + r) / 2;
        add(v * 2 + 1, l, m, ql, qr);
        add(v * 2 + 2, m, r, ql, qr);
        t[v] = max(t[v * 2 + 1], t[v * 2 + 2]);
    }


    int get(int v, int l, int r, int ql, int qr) {
        push(v, l, r);
        if (qr <= l || r <= ql) {
            return 0;
        }
        if (ql <= l && r <= qr) {
            return t[v];
        }
        int m = (l + r) / 2;
        return max(get(v * 2 + 1, l, m, ql, qr), get(v * 2 + 2, m, r, ql, qr));
    }

    void resize(int _n) {
        n = _n;
        t.resize(n * 4);
        p.resize(n * 4);
    }
};

vector <int> d;

void preCalc(int v = 0) {
    sz[v] = 1;
    d[v] = 0;
    for (auto &u: g[v]) {
        preCalc(u);
        d[v] = max(d[v], d[u] + 1);
        sz[v] += sz[u];
    }
}

vector<int> up;
int timer = -1;

SegTree t;

void dfs(int v = 0) {
    for (int i = 0; i < g[v].size(); i++) {
        if (sz[g[v][0]] < sz[g[v][i]]) swap(g[v][0], g[v][i]);
    }
    tin[v] = ++timer;
    for (int i = 0; i < g[v].size(); i++) {
        up[g[v][i]] = (i ? g[v][i] : up[v]);
        dfs(g[v][i]);
    }
}

int n;

void add(int v) {
    while (v != -1) {
        t.add(0, 0, n, tin[up[v]], tin[v] + 1);
        v = p[up[v]];
    }
}

int get(int v) {
    int lst = n - 1;
    int ans = 0;
    while (v != -1) {
        if (tin[v] + 1 <= lst) {
            ans = max(ans, t.get(0, 0, n, tin[v] + 1, lst + 1));
        }
        lst = tin[up[v]] - 1;
        v = p[up[v]];
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    int q;
    cin >> n >> q;
    g.resize(n);
    p.resize(n, -1);
    a.resize(n);
    for (int i = 1; i < n; i++) {
        cin >> p[i];
        p[i]--;
        g[p[i]].emplace_back(i);
    }
    for (auto &it: a) cin >> it;
    set<pair<int, int>> st;
    st.insert({a[0], 0});
    sz.resize(n);
    tin.resize(n);
    d.resize(n);
    up.resize(n);
    preCalc();
    dfs();
    t.resize(n);
    int cnt = 0;
    vector<int> res(n);
    while (!st.empty()) {
        int v = st.rbegin()->second;
        st.erase(--st.end());
        for (auto &u: g[v]) {
            st.insert({a[u], u});
        }
        res[v] = cnt - get(v);
        add(v);
        cnt++;
    }
    while (q--) {
        int v;
        cin >> v;
        v--;
        cout << res[v] << ' ';
    }
    return 0;
}
