#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

pair<int, int> getAns(int v, int mi, vector<int>& pred, vector<vector<int>>& tree, vector<int>& s, vector<vector<int>>& vec) {
    if (v==0) return {0, 0};
    mi = min(mi, s[v]);
    pair<int, int> ans = {1, 0};
    for (auto u : tree[pred[v]]) {
        if (u==v) continue;
        int c = vec[u][mi];
        ans.first+=c;
        ans.second = max(ans.second, c);
    }
    pair<int, int> a = getAns(pred[v], mi, pred, tree, s, vec);
    ans.first += a.first;
    ans.second = max(ans.second, a.second);
    return ans;
}

void dfs(int v, vector<vector<int>>& tree, vector<int>& s, vector<vector<int>>& vec) {
    for (int i = 0; i < s[v]; ++i) ++vec[v][i];
    for (auto u : tree[v]) {
        dfs(u, tree, s, vec);
        for (int i = 0; i < s[v]; ++i) vec[v][i] += vec[u][i];
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int n, q; cin >> n >> q;
    vector<int> pred(n);
    vector<vector<int>> tree(n);
    for (int i = 1; i < n; ++i) {
        cin >> pred[i]; --pred[i];
        tree[pred[i]].emplace_back(i);
    }
    vector<int> s(n);
    for (int i = 0; i < n; ++i) cin >> s[i];
    vector<vector<int>> vec(n, vector<int>(n));
    dfs(0, tree, s, vec);
    while (q--) {
        int v; cin >> v; --v;
        pair<int, int> ans = getAns(v, n, pred, tree, s, vec);
        cout << ans.first-ans.second << ' ';
    }
    cout << '\n';

    return 0;
}
