#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("unroll-loops")
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #pragma GCC target("avx2")
#include<bits/stdc++.h>
// using namespace __gnu_pbds;
using namespace std;
using ll = long long;
// using ordered_map = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
// using hash_map = gp_hash_table<int, int>;
#define watch(x) cout << #x << ": " << x << '\n';
#define watch_arr(arr) cout << #arr << ": "; \
for (int i = 0; i < (int)arr.size(); ++i) { \
    cout << arr[i] << ' '; \
} \
cout << '\n';
#define all(arr) arr.begin(), arr.end()

random_device rd;
mt19937 rnd(rd());

const int INF = 1e9;

vector<vector<int>> g;
vector<int> s, children, p, used;
int del, epoch = 0;

void bfs(int ask) {
    priority_queue<pair<int, int>> pq;
    pq.push({s[0], 0});
    while (!pq.empty()) {
        auto [c, v] = pq.top();
        pq.pop();
        used[v] = epoch;
        if (v == ask) return;
        for (auto to : g[v]) {
            pq.push({s[to], to});
        }
    }
}

void dfs(int v) {
    int cnt = 1;
    for (auto to : g[v]) {
        if (used[to] != epoch) {
            children[to] = 0;
            continue;
        }
        dfs(to);
        cnt += children[to];
    }
    children[v] = cnt;
}

void up(int v, int ch) {
    while (ch) {
        for (auto to : g[v]) {
            if (to != ch) del = max(del, children[to]);
        }
        ch = v, v = p[v];
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, q;
    cin >> n >> q;
    g.resize(n);
    s.resize(n);
    p.resize(n);
    used.resize(n);
    children.resize(n);
    for (int i = 1; i < n; ++i) {
        int cur_p;
        cin >> cur_p;
        g[--cur_p].emplace_back(i);
        p[i] = cur_p;
    }
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }

    for (int i = 0; i < q; ++i) {
        ++epoch;
        int v;
        cin >> v;
        --v;
        del = 0;
        bfs(v);
        dfs(0);
        up(v, -1);
        cout << children[0] - del - 1 << ' ';
    }

    return 0;
}
