#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const ll INF = 1e15;

vector<vector<int>> g;
vector<int> s, depth, mins;

void dfs0(int v) {
    for (auto i : g[v]) {
        depth[i] = depth[v] + 1;
        dfs0(i);
    }
}

void dfs(int v, int now) {
    now = min(now, s[v]);
    mins[v] = now;
    for (auto i : g[v]) dfs(i, now);
}

void solve() {
    int n, q;
    cin >> n >> q;
    g.assign(n, {});
    vector<int> parent(n, 0);
    for (int i = 1; i < n; ++i) {
        int pp; cin >> pp; --pp;
        g[pp].push_back(i);
        parent[i] = pp;
    }
    depth.assign(n, 0);
    dfs0(0);
    s.assign(n, 0);
    for (int i = 0; i < n; ++i) cin >> s[i];
    vector<vector<int>> ways;
    for (auto i : g[0]) {
        ways.push_back({});
        int now = i;
        while (g[now].size() > 0) {
            ways.back().push_back(now);
            now = g[now][0];
        }
    }
    vector<int> which(n);
    for (int i = 0; i < ways.size(); ++i) {
        for (int j = 0; j < ways[i].size(); ++j) {
            which[ways[i][j]] = i;
        }
    }
    mins.assign(n, 1e8);
    for (auto i : g[0]) dfs(i, 1e8);
    while (q--) {
        int v;
        cin >> v;
        --v;
        vector<int> bother;
        // get bother
        for (int i = 0; i < ways.size(); ++i) {
            if (i == which[v]) continue;
            int l = 0, r = ways[i].size();
            while (r - l > 1) {
                int m = (r + l) / 2;
                if (mins[ways[i][m]] < mins[v]) r = m;
                else l = m;
            }
            bother.push_back(l);
        }

        int s = 0;
        for (int i = 0; i < bother.size(); ++i) s += bother[i];
        if (bother.size() > 0) s -= *max_element(bother.begin(), bother.end());
        cout << s + depth[v] << " ";
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll t = 1;
    // cin >> t;
    while (t--) solve();
}
