//#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#pragma GCC target("avx2")
using namespace std;
using ll = int64_t;
constexpr ll N = 3e5 + 1;
vector<ll> g[N];
ll s[N], tin[N], tout[N];
ll timer = 0;

void dfs(ll v) {
    tin[v] = timer++;
    for (auto &u : g[v]) {
        dfs(u);
    }
    tout[v] = timer++;
}

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

ll GetCnt(ll v, ll ban) {
    set<pair<ll, ll>> st;
    for (auto &u : g[1]) {
        if (u != ban) {
            st.insert({ s[u], u });
        }
    }
    ll cnt = 0, tec = 1;
    while (tec != v) {
        ++cnt;
        auto u = (--st.end())->second;
        st.erase(--st.end());
        tec = u;
        for (auto &e : g[tec]) {
            if (e != ban) {
                st.insert({s[e], e});
            }
        }
    }
    return cnt;
}

void solve() {
    ll n, q;
    cin >> n >> q;
    for (ll i = 2, p; i <= n; ++i) {
        cin >> p;
        g[p].push_back(i);
    }
    for (ll i = 1; i <= n; ++i) {
        cin >> s[i];
    }
    dfs(1);
    while (q --> 0) {
        ll u;
        cin >> u;
        ll ans = GetCnt(u, -1);
        for (ll i = 2; i <= n; ++i) {
            if (!upper(i, u)) {
                ans = min(ans, GetCnt(u, i));
            }
        }
        cout << ans << '\n';
    }
}

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

    ll t = 1;
//    cin >> t;
    while (t --> 0) {
        solve();
    }

    return 0;
}

