#include <bits/stdc++.h>
#define int long long

using namespace std;

const int inf = 2e9;

vector<vector<pair<int, int>>> g;
vector<int> ans; int mx = 0, timer = 0;
int dfs(int v) {
    ans[v] = timer++;
    ans[v] -= mx;
    int sum = 1;
    for (auto [f, u]: g[v]) {
        sum += dfs(u);
    }
    mx = max(mx, sum);
    return sum;
}

void solve() {
    int n, k; cin >> n >> k;
    vector<int> p(n), s(n);
    g.resize(n);
    for (int i = 1; i < n; ++i) {
        cin >> p[i]; --p[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
        if (i != 0) {
            g[p[i]].push_back({-s[i], i});
        }
    }
    for (int i = 0; i < n; ++i) {
        sort(g[i].begin(), g[i].end());
    }
    ans.resize(n, inf);
    dfs(0);
    for (int i = 0; i < k; ++i) {
        int x; cin >> x;
        cout << ans[x - 1] << ' ';
    }
    cout << '\n';
}

signed main(void) {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    solve();
}