#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int n, q;
vector<int> p;
vector<vector<int>> g;
vector<int> s;
vector<int> ans;
vector<int> sz;
vector<int> szdown1;
vector<int> szdown2;
vector<bool> used;

void dfs(ll v) {
    sz[v] = 1;
    szdown1[v] = 0;
    szdown2[v] = 0;
    for (auto to : g[v]) {
        if (used[to]) {
            dfs(to);
            sz[v] += sz[to];
            if (sz[to] > szdown1[v]) {
                szdown2[v] = szdown1[v];
                szdown1[v] = sz[to];
            } else if (sz[to] > szdown2[v]) {
                szdown2[v] = sz[to];
            }
        }
    }
}


int main(int, char**) {
    cout << setprecision(15) << fixed;
#ifdef DEBUGMB
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#endif

    cin >> n >> q;
    p.assign(n, -1);
    g.resize(n);
    sz.assign(n, 0);
    szdown1.assign(n, 0);
    szdown2.assign(n, 0);
    s.resize(n);
    ans.resize(q);
    used.assign(n, false);
    for (int i = 1; i < n; ++i) {
        cin >> p[i];
        p[i]--;
        g[p[i]].emplace_back(i);
    }
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }
    vector<int> mp(n + 5, -1);
    for (int i = 0; i < q; ++i) {
        ll x;
        cin >> x;
        x--;
        mp[x] = i;
    }
    priority_queue<pair<int, int>> que;
    que.push({ s[0], 0 });
    int cnt = 0;
    while (!que.empty()) {
        auto [ss, v] = que.top();
        que.pop();
        used[v] = true;
        cnt++;
        int res;
        int u = v;
        int biggest = 0;
        if (mp[v] != -1) {
            dfs(0);
            while (p[u] != -1) {
                biggest = max(biggest, (sz[u] == szdown1[p[u]] ? szdown2[p[u]] : szdown1[p[u]]));
                u = p[u];
            }
        }
        if (mp[v] != -1) {
            ans[mp[v]] = cnt - biggest - 1;
        }

        for (auto to : g[v]) {
            que.push({ s[to], to });
        }
    }
    for (auto el : ans) {
        cout << el << " ";
    }




    return 0;
}
