#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using li = __int128;
using db = double;
using ld = long double;
using pi = pair <int, int>;
using pll = pair <ll, ll>;
#define all(x) x.begin(), x.end()

const ll INFll = 3e14;

//mt19937 rnd(time(NULL));

void solve() {
    int n, q;
    cin >> n >> q;
    vector <int> p(n + 1);
    p[1] = 0;
    vector <vector <int>> g(n + 1);
    for (int i = 2; i <= n; ++i) {
        cin >> p[i];
        g[p[i]].push_back(i);
    }
    vector <int> deep(n + 1);
    vector <int> sz(n + 1, 1);
    vector <int> s(n + 1);
    for (int i = 1; i <= n; ++i) cin >> s[i];
    auto dfs = [&](auto self, int v)->void {
        for (auto u : g[v]) {
            deep[u] = deep[v] + 1;
            self(self, u);
            sz[v] += sz[u];
        }
    };
    dfs(dfs, 1);
    vector <pair <pair <int, int>, int>> vec;
    for (auto u : g[1]) {
        vec.push_back({{s[u], sz[u]}, u});
    }
    sort(all(vec));
    reverse(all(vec));
    int mx = 0;
    int sum = 0;
    vector <int> ans(n + 1);
    for (auto [x, pa] : vec) {
        ans[pa] = sum - mx + 1;
        sum += x.second;
        mx = max(mx, x.second);
    }
    auto rec = [&](auto self, int v)->void {
        for (auto u : g[v]) {
            ans[u] = ans[v] + 1;
            self(self, u);
        }
    };
    for (auto u : g[1]) rec(rec, u);

    while (q--) {
        int x;
        cin >> x;
        cout << ans[x] << '\n';
    }
}


int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) solve();
    return 0;
}
