#include <bits/stdc++.h>
using namespace std;
#define int long long
const long long INF = 1e18, MOD = 1e9 + 7;

void solve();

vector <vector <int>> g;
vector <int> par;
vector <int> a;
pair <int, int> get(int v, int mn){
    if (par[v] <= 0){
        return {v, mn};
    }
    return get(par[v], min(mn, a[par[v]]));
}
vector <int> dp;
void dfs(int v, int x){
    dp[v] = 1;
    for (auto to : g[v]){
        if (a[to] > x){
            dfs(to, x);
            dp[v] += dp[to];
        }
    }
}
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, q;
    cin >> n >> q;
    g.resize(n);
    par.resize(n);
    par[0] = -1;
    for (int i = 1; i < n; i++){
        int p;
        cin >> p;
        p--;
        par[i] = p;
        g[p].push_back(i);
    }
    a.resize(n);
    vector <int> a1(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a1[i] = a[i];
    }
    a1[0] = -1;
    sort(a1.begin(), a1.end());
    vector <int> ans(n, 0);
    for (int i = 1; i < n; i++){
        auto zz = get(i, a[i]);
        dp.assign(n, 0);
        dfs(0, zz.second);
        int c = lower_bound(a1.begin(), a1.end(), a[i]) - a1.begin();
        int qq = 0;
        for (auto s : g[0]){
            if (s != zz.first){
                qq = max(qq, dp[s]);
            }
        }
        ans[i] = n - c - qq;
    }
    while (q--){
        int v;
        cin >> v;
        v--;
        cout << ans[v] << " ";
    }
}
