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

#ifndef local
#pragma GCC optimize("03")
#pragma GCC target("avx2")
#endif

#define endl '\n'
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()

#ifdef local
#define dbg(x) cout << __LINE__ << " : " << (#x) << " = " << x << endl;
#else
#define dbg(x) ;
#endif

static inline bool check(int l1, int r1, int l2, int r2) {
    return l1 >= r2 || l2 >= r1;
}

struct segtree {
    vector<vector<int>> t;
    segtree(int n, vector<int> &a) {
        t.resize(4 * n);
        build(0, n, 0, a);
    }
    void build(int lx, int rx, int x, vector<int> &a) {
        if (lx + 1 == rx) {
            t[x].push_back(a[lx]);
            return;
        }
        int m = (lx + rx) / 2;
        build(lx, m, 2 * x + 1, a);
        build(m, rx, 2 * x + 2, a);
        t[x].resize(sz(t[2 * x + 1]) + sz(t[2 * x + 2]));
        merge(all(t[2 * x + 1]), all(t[2 * x + 2]), t[x].begin());
    }
    int get(int lx, int rx, int x, int l, int r, int v) {
        if (lx >= r || l >= rx) {
            return 0;
        } else if (l <= lx && rx <= r) {
            return lower_bound(all(t[x]), v) - t[x].begin();
        }
        int m = (lx + rx) / 2;
        int a = 0, b = 0;
        if (!check(l, r, lx, m)) {
            a = get(lx, m, 2 * x + 1, l, r, v);
        }
        if (!check(l, r, m, rx)) {
            b = get(m, rx, 2 * x + 2, l, r, v);
        }
        return a + b;
    }
};

void solve() {
    int n, Q;
    cin >> n >> Q;
    vector<vector<int>> g(n);
    vector<int> p(n, -1), tin(n), tout(n), s(n), ans(n);
    for (int i = 1; i < n; i++) {
        cin >> p[i];
        p[i]--;
        g[p[i]].push_back(i);
    }
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    priority_queue<pair<int, int>> q;
    for (int u : g[0]) {
        q.push({s[u], u});
    }
    int day = 1;
    while (!q.empty()) {
        auto [val, v] = q.top();
        q.pop();
        ans[v] = day++;
        for (int u : g[v]) {
            q.push({s[u], u});
        }
    }
    int time = 0;
    vector<int> a;
    auto dfs = [&](int v, auto &&dfs) -> void {
        tin[v] = time++;
        a.push_back(ans[v]);
        for (int u : g[v]) {
            dfs(u, dfs);
        }
        tout[v] = time;
    };
    auto par = [&](int v, int u) {
       return tin[v] <= tin[u] && tout[u] <= tout[v];
    };
    dfs(0, dfs);
    segtree t(n, a);
    while (Q--) {
        int v;
        cin >> v;
        v--;
        int cur = 0;
        int u = p[v], prev = v;
//        while (u != -1) {
//            for (int x : g[u]) {
//                if (x == prev) continue;
//                int get = t.get(0, n, 0, tin[x], tout[x], ans[v]);
//                cur = max(cur, get);
//            }
//            prev = u;
//            u = p[u];
//        }
        for (int i = 0; i < min(20, sz(g[0])); i++) {
            int x = g[0][i];
            if (par(x, v)) {
                continue;
            }
            int get = t.get(0, n, 0, tin[x], tout[x], ans[v]);
            cur = max(cur, get);
        }
        cout << ans[v] - cur << ' ';
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef local
    freopen("in.txt", "r", stdin);
#endif
    solve();
    return 0;
}
