#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
// #pragma GCC optimize("03")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("avx,avx2,bmi2,fma")


vector<vector<int>> g, gkal;
vector<int> p, s, dir, ans, tin, tout;
int tnow = 0;

void dfs(int v) {
    // cout << "F " << v << endl;
    int Max = 0, ind = -1;
    for (auto& it : gkal[v]) {
        if (Max < s[it]) {
            Max = s[it];
            ind = it;
        }
    }
    if (ind == -1) {
        return;
    }
    dir.push_back(ind);
    for (auto& it : gkal[v]) {
        if (it == ind) {
            continue;
        }
        gkal[ind].push_back(it);
    }
    dfs(ind);
}

void dfs0(int v) {
    tin[v] = tnow++;
    for (auto& it : g[v]) {
        dfs0(it);
    }
    tout[v] = tnow++;
}

void dfs1(int v, int& start, int& cnt_now) {
    cnt_now++;
    for (auto& it : g[v]) {
        if (ans[it] < ans[start]) {
            dfs1(it, start, cnt_now);
        }
    }
}

int f(int& start) {
    int Max = 0;
    for (auto& it : dir) {
        if (it == start) {
            break;
        }
        if (tin[it] < tin[start] && tout[start] < tout[it]) {
            continue;
        }
        int cnt_now = 0;
        dfs1(it, start, cnt_now);
        Max = max(Max, cnt_now);
    }
    return Max;
}

signed main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n, q;
    cin >> n >> q;
    gkal.resize(n);
    g.resize(n);
    p.resize(n);
    s.resize(n);
    tin.resize(n);
    tout.resize(n);
    for (int i = 1; i < n; ++i) {
        cin >> p[i];
        p[i]--;
        g[p[i]].push_back(i);
        gkal[p[i]].push_back(i);
    }
    for (auto& it : s) {
        cin >> it;
    }
    dir.push_back(0);
    dfs(0);
    dfs0(0);

    ans.resize(n);
    for (int i = 0; i < n; ++i) {
        ans[dir[i]] = i;
    }

    while (q--) {
        int v;
        cin >> v;
        v--;
        // cout << f(v) << endl;
        int now = ans[v] - f(v);
        cout << now << ' ';
    }
}

/*
5 4
1 2 2 1
3 5 1 2 4
5 3 1 4


1 3 0 2
*/