#include <bits/stdc++.h>

using namespace std;
#define int long long
vector <int> dp,s,ans;
vector < vector < int > > g;
multiset <int> st;
bool cmp (int a,int b) {
    return s[a] > s[b];
}
void dfs (int v) {
    if (*st.begin() < ans[v]) {
        dp[v] = 1;
    }
   for (auto u: g[v]) {
        st.insert(ans[u]);
   }
   for (auto u: g[v]) {
        st.erase (st.find(ans[u]));
        dfs (u);
        st.insert(ans[u]);
   }
   for (auto u: g[v]) {
        st.erase (st.find(ans[u]));
    }
}


void solve () {
    int n,q;
    cin >> n >> q;
    g = vector < vector < int > > (n + 1);
    for (int v = 2;v <= n;v++) {
        int p;
        cin >> p;
        g[p].push_back(v);
    }
    dp = s = vector < int > (n + 1,0);
    for (int v = 1;v <= n;v++) {
        cin >> s[v];
    }
    ans = vector <int> (n + 1);
    set < pair < int, int >, greater < pair < int, int > > > cur;
    cur.insert ({s[1],1});
    int t = 0;
    while (!cur.empty()) {
        auto [_,v] = *cur.begin();
        cur.erase (cur.begin());
        ans[v] = t;
        for (auto u: g[v]) {
            cur.insert({s[u],u});
        }
        t++;
    }
    st.insert(1e18);
    dfs (1);
    while (q--) {
        int v;
        cin >> v;
        cout << ans[v] - dp[v] << endl;
    }


}
signed main () {
#ifdef LOCAL 
    freopen ("input.txt","r",stdin);
#endif
    solve();
    return 0;
}