#pragma GCC optimize("O3,unroll-loops,inline")

#include <bits/stdc++.h>
#include <bits/extc++.h>

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using ull = unsigned long long;

//tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> st;
//gp_hash_table<int, int> a;

//struct segtree {
//    vector<int> tr;
//    int n;
//    segtree(int n) : n(n), tr(2 * n) {}
//    void upd(int i, int x) {
//        for (tr[i += n] = x; i >= 0; tr[i >>= 1] = max(tr[i], tr[i ^ 1]));
//    }
//    int get(int l, int r) {
//        int ans = 0;
//        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
//            if (l & 1)
//                ans = max(ans, tr[l++]);
//            if (~r & 1)
//                ans = max(ans, tr[r--]);
//        }
//        return ans;
//    }
//};

struct fenwick {
    vector<int> t;
    int n;
    fenwick(int n) : n(n), t(n + 1) {}
    void upd(int i, int x) {
        for (++i; i <= n; i += i & -i) t[i] += x;
    }
    int get(int i) {
        int x = 0;
        for (++i; i > 0; i -= i & -i) x += t[i];
        return x;
    }
};

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmax(T &a, const T &b) {
    if (b > a) {
        a = b;
        return true;
    }
    return false;
}

struct segtree {
    vector<int> tree, add;
    int n;
    segtree(int n) : n(n), tree(4 * n), add(4 * n) {}
    void push(int v, int tl, int tr) {
        if (tl != tr)
            add[v * 2] += add[v], add[v * 2 + 1] += add[v];
        tree[v] += add[v];
        add[v] = 0;
    }
    void upd(int v, int tl, int tr, int l, int r, int x) {
        push(v, tl, tr);
        if (r < tl || tr < l)
            return;
        if (l <= tl && tr <= r) {
            add[v] += x;
            push(v, tl, tr);
            return;
        }
        int tm = (tl + tr) / 2;
        upd(v * 2, tl, tm, l, r, x), upd(v * 2 + 1, tm + 1, tr, l, r, x);
        tree[v] = max(tree[v * 2], tree[v * 2 + 1]);
    }
    void upd(int l, int r, int x) {
        if (l > r)
            return;
        upd(1, 0, n - 1, l, r, x);
    }
    int get(int v, int tl, int tr, int l, int r) {
        push(v, tl, tr);
        if (r < tl || tr < l)
            return 0;
        if (l <= tl && tr <= r)
            return tree[v];
        int tm = (tl + tr) / 2;
        return max(get(v * 2, tl, tm, l, r), get(v * 2 + 1, tm + 1, tr, l, r));
    }
    int get(int l, int r) {
        if (l > r)
            return 0;
        return get(1, 0, n - 1, l, r);
    }
};

mt19937 rnd(1337);

constexpr int N = 3e5;
vector<int> gr[N];
int par[N];

struct hld {
    segtree tr;
    vector<int> s, fup, tin;
    int n;
    int timer = 0;
    int sz(int v) {
        s[v] = 1;
        for (int u : gr[v])
            s[v] += sz(u);
        sort(all(gr[v]), [&](int i, int j) {
            return s[i] > s[j];
        });
        return s[v];
    }
    void dfs(int v, int s) {
        fup[v] = s;
        tin[v] = timer++;
        if (gr[v].size() > 0)
            dfs(gr[v][0], s);
        for (int i = 1; i < gr[v].size(); ++i)
            dfs(gr[v][i], gr[v][i]);
    }
    hld(int n) : n(n), tr(n), s(n), fup(n), tin(n) {
        sz(0);
        dfs(0, 0);
    }
    vector<pair<int, int>> calc(int v) {
        vector<pair<int, int>> seg;
        while (fup[v] != 0) {
            seg.push_back({tin[fup[v]], tin[v]});
            v = par[fup[v]];
        }
        seg.push_back({tin[0], tin[v]});
        return seg;
    }
    void upd(int v) {
        auto a = calc(v);
        for (auto [l, r] : a)
            tr.upd(l, r, 1);
    }
    int get(int v) {
        auto a = calc(v);
        if (a.size() == 0)
            return tr.get(0, n - 1);
        sort(all(a));
        int res = tr.get(0, a[0].first - 1);
        for (int i = 0; i + 1 < a.size(); ++i)
            res = max(res, tr.get(a[i].second + 1, a[i + 1].first - 1));
        res = max(res, tr.get(a.back().second + 1, n - 1));
        return res;
    }
};

void solve() {
    int n, q;
    cin >> n >> q;
    par[0] = 0;
    for (int i = 1, p; i < n; ++i) {
        cin >> p;
        --p;
        par[i] = p;
        gr[p].push_back(i);
    }
    vector<int> s(n);
    for (int &i : s)
        cin >> i;
    vector<int> ans(n);
    set<pair<int, int>> st = {{s[0], 0}};
    int cnt = 0;
    hld tr(n);
    while (!st.empty()) {
        int v = st.rbegin()->second;
        st.erase({s[v], v});
        for (int u : gr[v])
            st.insert({s[u], u});
        ans[v] = cnt - tr.get(v);
        cnt++;
        tr.upd(v);
    }
    while (q--) {
        int i;
        cin >> i;
        --i;
        cout << ans[i] << '\n';
    }
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int t = 1;
    // cin >> t;
    while (t--) solve();
//    cerr << fixed << setprecision(10) << clock() * 1.0 / CLOCKS_PER_SEC << '\n';
}
