#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;

vector<vector<int>> g;
vector<ll> a;
vector<int> dep, up, used, tin, tout;
vector<int> ord;

vector<int> ans;
vector<int> req;

ll gay = 0;

void dfs(int v, int p) {
    dep[v] = (p == -1 ? 0 : dep[p] + 1);
    gay += 1;
    tin[v] = gay;
    if (p == -1) {
        up[v] = -1;
    }
    else {
        up[v] = p;
    }
    for (auto to : g[v]) {
        if (to != p) {
            dfs(to, v);
        }
    }
    gay++;
    tout[v] = gay;
}

int anc(int v,  int u) {
    return (tin[v] <= tin[u] && tout[v] >= tout[u]);
}

void make(int v) {
    used[v] = 1;
    ord.push_back(v);
    int mx = -1;
    for (auto to : g[v]) {
        if (!used[to] && (mx == -1 || a[to] > a[mx])) {
            mx = to;
        }
    }
    if (mx == -1) return;
    for (auto to : g[v]) {
        if (!used[to] && to != mx) {
            g[mx].push_back(to);
        }
    }
    g[v].clear();
    make(mx);
}

int f(int x, vector<int> y) {
    for (int i = 0; i < y.size(); i++) {
        if (y[i] == x) return i;
    }
    return -1;
}

void solve() {
    int n, q; cin >> n >> q;
    a.resize(n);
    tin.resize(n), tout.resize(n);
    g.resize(n), used.resize(n), dep.resize(n), up.resize(n);
    for (int i = 2; i <= n; i++) {
        int p; cin >> p;
        g[p - 1].push_back(i - 1);
        g[i - 1].push_back(p - 1);
    }
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    dfs(0, -1);
    req.resize(n, -1);
    ans.resize(q);
    make(0);
    for (int i = 0; i < q; i++) {
        ll v; cin >> v;
        v--;
        req[v] = i;
    }
    int h = *max_element(dep.begin(), dep.end());
    vector<set<pair<int, int>>> bst(h + 1);
    vector<int> cnt(n);
    for (int i = 0; i < n; i++) {
        bst[dep[i]].insert({cnt[i], i});
    }
    vector<int> vis;
    vector<pair<int, int>> buf;
    for (int i = 0; i < ord.size(); i++) {
        int x = ord[i];
        while (x != -1) {
            vis.push_back(x);
            x = up[x];
        }
        for (auto v : vis) {
            bst[dep[v]].erase({cnt[v], v});
            cnt[v]++;
            bst[dep[v]].insert({cnt[v], v});
        }
        vis.clear();
        x = ord[i];
        if (req[x] == -1) continue;
        int cut = 0;
        for (int cur = 1; cur <= h; cur++) {
            while (!bst[cur].empty()) {
                auto cand = *bst[cur].rbegin();
                if (!anc(cand.second, x)) {
                    cut = max(cut, cand.first);
                    break;
                }
                else {
                    buf.push_back(cand);
                    bst[cur].erase(cand);
                }
            }
            for (auto cand: buf) {
                bst[cur].insert(cand);
            }
            buf.clear();
        }
        ans[req[x]] = i - cut;
    }
    for (auto x : ans) cout << x << ' ';
}

int main() {
    int t = 1; //cin >> t;
    cin.tie(0);
    ios::sync_with_stdio(0);
    while (t--) {
        solve();
    }
}
