#include<iostream>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<random>
#include<chrono>
#include<algorithm>

using namespace std;

#pragma GCC optimize("O3")

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// #define int long long

const int MAX = 3e5 + 1;
vector<int> g[MAX];
int pos[MAX], son[MAX], val[MAX], tree_mx[MAX], tree_mx1[MAX], ans[MAX], timer[MAX], sz[MAX];
// vector<int> pos, son, val;


bool cmp(int a, int b) {
    return val[a] < val[b];
}

void dfs(int v, int p, int s) {
    // cout << v << ' ';
    sz[v] = 1;
    for (auto u : g[v]) {
        if (u != p) {
            dfs(u, v, s);
            sz[v] += sz[u];
        }
    }
}

int mx = 0, cur = 0;

void solve(int v, int p) {
    if (timer[v] != -1) {
        ans[timer[v]] = cur - mx;
    }
    cur++;
    for (auto u : g[v]) {
        if (u != p) {
            solve(u, v);
        }
    }
    mx = max(mx, sz[v]);
}

signed main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // cout.precision(20);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    fill(timer, timer + MAX, -1);
    int n, q;
    cin >> n >> q;
    vector<int> p(n, -1);
    for (int i = 0; i < n - 1; ++i) {
        int x;
        cin >> x;
        x--;
        p[i + 1] = x;
        g[x].push_back(i + 1);
    }
    for (int i = 0; i < n; i++) {
        cin >> val[i];
    }
    for (int i = 0; i < n; i++) {
        sort(g[i].begin(), g[i].end(), cmp);
        reverse(g[i].begin(), g[i].end());
    }
    dfs(0, 0, -1);
    cout << '\n';
    for (int i = 0; i < q; i++) {
        int num;
        cin >> num;
        num--;
        timer[num] = i;
    }
    solve(0, 0);
    for (int i = 0; i < q; i++) {
        cout << ans[i] << ' ';
    }
    cout << '\n';
}
