#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;

#define int ll
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using ordered_set = __gnu_pbds::tree<int, __gnu_pbds::null_type, less<int>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

mt19937 rnd(time(0));

const int MAXN = 3e5 + 52;
vector<int> g[MAXN];
vector<int> g1[MAXN];
int s[MAXN];
int p[MAXN];

bool comp(int a, int b) {
    return s[a] > s[b];
}

int dp[MAXN][2];
int sz[MAXN];

void dfs(int v) {
    vector<int> al;
    sz[v] = 1;
    for (auto &u: g[v]) {
        al.push_back(u);
    }
    if (al.empty()) return;
    sort(all(al), comp);
    dp[al[0]][0] = dp[v][0] + 1;
    dp[al[0]][1] = dp[v][1] + 1;
    int s1 = 0;
    for (auto &u: al) {
        if (u != al[0]) {
            dp[u][0] = dp[v][0] + s1 + 1;
            dp[u][1] = min(dp[v][1] + s1 + 1, dp[v][0] + s1 - sz[al[0]] + 1);
        }
        dfs(u);
        sz[v] += sz[u];
        s1 += sz[u];
    }
}

inline void solve() {
    int n, q;
    cin >> n >> q;
    for (int i = 1; i < n; i++) {
        dp[i][0] = 1e9;
        dp[i][1] = 1e9;
    }
    for (int i = 1; i < n; i++) {
        cin >> p[i];
        p[i]--;
        g[p[i]].push_back(i);
    }
    for (int i = 0; i < n; i++) cin >> s[i];
    dfs(0);
    while (q--) {
        int v;
        cin >> v;
        v--;
        cout << dp[v][1] << " ";
    }
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) solve();
}