//#pragma GCC optimize("O3, Ofast, unroll-loops, inline, no-stack-protector")
#include <bits/stdc++.h>
//#pragma GCC target("avx2")

using namespace std;

using ll = long long;
using pii = pair<int, int>;

vector<vector<int>> g;
vector<int> cnt, s;


int ans = 1e9;
vector<int> p, d;

void dfs1(int v) {
    for (auto u : g[v]) {
        d[u] = d[v] + 1;
        dfs1(u);
    }
}

void calc(int v, int val) {
    if (v != 0 && s[v] < val) return;
    cnt[v] = 1;
    for (auto u : g[v]) {
        calc(u, val);
        cnt[v] += cnt[u];
    }
}

void dfs(int v, int dp0, int dp1, int val, int last) {
    if (last != -1) {
        dp0 += 1;
        dp1 += 1;
    }
    int sum = 0, mx = 0;
    for (auto u : g[v]) {
        if (u == last) continue;
        calc(u, val);
        sum += cnt[u];
        mx = max(mx, cnt[u]);
    }
    dp1 = min(dp0 + sum - mx, dp1 + sum);
    dp0 += sum;
    if (v == 0) {
        ans = dp1;
        return;
    }
    dfs(p[v], dp0, dp1, min(val, s[v]), v);
}

vector<vector<int>> vals, qs;
vector<int> query, ans0, ans1;


void dfs_ans(int v) {
    for (auto u : g[v]) {
        dfs_ans(u);
        for (auto el : vals[u]) vals[v].push_back(el);
        for (auto el : qs[u]) qs[v].push_back(el);
    }
    vals[v].push_back(s[v]);
    std::sort(vals[v].begin(), vals[v].end());
    for (auto u : g[v]) {
        for (auto i : qs[u]) {
            int sum = 0, mx = 0;
            for (auto u2: g[v]) {
                if (u != u2) {
                    int res = std::lower_bound(vals[u2].begin(), vals[u2].end(), query[i]) - vals[u2].begin();
                    res = (int) vals[u2].size() - res;
                    sum += res;
                    mx = max(res, mx);
                }
            }
            ans1[i] = min(ans1[i] + sum, ans0[i] + sum - mx) + 1;
            ans0[i] += sum + 1;
        }
    }
    for (auto & val : vals[v]) val = min(val, s[v]);
    for (auto q : qs[v]) query[q] = min(query[q], s[v]);
}



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, q;
    cin >> n >> q;
    g.resize(n);
    p.resize(n, -1);
    s.resize(n);
    vector<int> ptrs;
    vector<vector<int>> line;
    for (int i = 1; i < n; ++i) {
        cin >> p[i];
        --p[i];
        if (p[i] == 0) {
            ptrs.emplace_back();
            line.push_back({0, i});
        } else {
            line.back().push_back(i);
        }
        g[p[i]].push_back(i);
    }
    for (int i = 0; i < n; ++i) cin >> s[i];
    set<pii> st;
    set<pii> s_ptr;
    int cnt = line.size();
    for (int i = 0; i < cnt; ++i) {
        st.insert({-s[line[i][1]], i});
        s_ptr.insert({0, i});
    }
    int sum = 0;
    vector<int> ans(n);
    while (!st.empty()) {
        auto [num, i] = *st.begin();
        st.erase(st.begin());
        s_ptr.erase({-ptrs[i], i});
        int mx = 0;
        ptrs[i] += 1;
        sum += 1;
        if (!s_ptr.empty()) {
            mx = s_ptr.begin()->first;
            mx *= -1;
        }
        ans[line[i][ptrs[i]]] = sum - mx;
        s_ptr.insert({-ptrs[i], i});
        if (ptrs[i] != (int) line[i].size() - 1) {
            st.insert({-s[line[i][ptrs[i] + 1]], i});
        }
    }
    for (int i = 0; i < q; ++i) {
        int v;
        cin >> v;
        --v;
        cout << ans[v] << " ";
    }
}

