#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 3e5 + 7;

vector <int> v[N];
int c[N];
int ans[N];
int cnt[N];
int tin[N], tout[N];
int t = 0;

void dfs(int x) {
    tin[x] = t++;
    for (auto u: v[x]) {
        dfs(u);
    }
    tout[x] = t++;
}

bool anc(int a, int b) {
    return tin[a] <= tin[b] && tout[a] >= tout[b];
}

void dfs1(int x, int zn) {
    cnt[x] = 0;
    if (ans[x] < zn) {
        cnt[x]++;
    }
    for (auto u: v[x]) {
        dfs1(u, zn);
        cnt[x] += cnt[u];
    }
}

signed main() {
    int n, q;
    cin >> n >> q;
    for (int i = 1; i < n; i++) {
        int p;
        cin >> p;
        p--;
        v[p].push_back(i);
    }
    //cout << "HERE" << endl;
    for (int i = 0; i < n; i++) {
        cin >> c[i];
    }
    int zn1 = 0;
    set <pair <int, int>> st;
    st.insert({c[0], 0});
    while (!st.empty()) {
        auto [c1, pos] = *st.rbegin();
        ans[pos] = zn1;
        zn1++;
        st.erase({c1, pos});
        for (auto u: v[pos]) {
            st.insert({c[u], u});
        }
    }
    //cout << "HERE" << endl;
    vector <int> ans1;
    dfs(0);
    while (q--) {
        int x;
        cin >> x;
        dfs1(0, ans[x - 1]);
        int mx = 0;
        for (int i = 0; i < n; i++) {
            if (!anc(i, x) && !anc(x, i)) {
                mx = max(mx, cnt[i]);
            }
        }
        ans1.push_back(ans[x - 1] - mx);
    }
    for (auto u: ans1) {
        cout << u << " ";
    }
}

