#include <bits/stdc++.h>
using namespace std;
#define int long long

const int maxn = 1e6;
vector<int> g[maxn];
int a[maxn], s[maxn], ans[maxn];

void emulate(set<pair<int, int>> & st) {
    int nm = 0;
    while (!st.empty()) {
        auto [x, v] = *st.begin();
        ans[v] = min(ans[v], nm);
        for (auto u : g[v]) {
            st.insert({-s[u], u});
        }
        st.erase({x, v});
        nm++;
    }
    return;
}

void solve() {
    int n, q;
    cin >> n >> q;
    fill(ans, ans + n, 1e7);
    for (int i = 1; i < n; i++) {
        int x;
        cin >> x; x--;
        g[x].push_back(i);
    }
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    for (int v = 1; v < n; v++) {
        int val = s[v];
        s[v] = 0;
        set<pair<int, int>> st;
        st.insert({-s[0], 0});
        emulate(st);
        s[v] = val;
    }
    while (q--) {
        int v;
        cin >> v; v--;
        cout << ans[v] << '\n';
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tests = 1;
    //cin >> tests;
    while (tests--) solve();
}

