#include <bits/stdc++.h>

#define int long long
using namespace std;

const int INF = 2e16;

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

signed main() {
    int n, q;
    cin >> n >> q;
    g.resize(n);
    s.resize(n);
    vector<int> h(n), pred(n);
    pred[0] = -1;
    for (int i = 1; i <= n - 1; i++) {
        int x;
        cin >> x;
        x--;
        pred[i] = x;
        h[i] = h[x] + 1;
        g[x].push_back(i);
        g[i].push_back(x);
    }
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    while (q--) {
        int x;
        cin >> x;
        x--;
        used.assign(n, 0);
        if (x == 0) {
            cout << 0 << " ";
            continue;
        }
        int cnt = 0, mn = s[x];
        vector<int> all;
        used[x] = 1;
        while (x != -1) {
            x = pred[x];
            if (x == -1) {
                break;
            }
            cnt++;
            used[x] = 1;
            if (x != 0) {
                mn = min(mn, s[x]);
            }
            for (auto v: g[x]) {
                if (used[v] == 0 && h[v] > h[x]) {
                    deque<int> pp;
                    pp.push_back(v);
                    int cnt1 = 0;
                    while (pp.size() != 0) {
                        int u = pp[0];
                        pp.pop_front();
                        if (s[u] < mn) {
                            continue;
                        }
                        cnt1++;
                        for (auto vv: g[u]) {
                            if (h[vv] > h[u]) {
                                pp.push_back(vv);
                            }
                        }
                    }
                    all.push_back(cnt1);
                }
            }
        }
        sort(all.begin(), all.end());
        for (int i = 0; i < (int)all.size() - 1; i++) {
            cnt += all[i];
        }
        cout << cnt << " ";
    }
}