#ifndef LOCAL
#pragma GCC optimize("Ofast")
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define X first
#define Y second

int n;

vector<int> s;
vector<vector<int>> g;
vector<int> tour, tin, tout;

int t = 0;

void dfs(int u)
{
    tin[u] = t++;
    for (int v : g[u])
        dfs(v);
    tout[u] = t;
}

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

void solve()
{
    int q;
    cin >> n >> q;
    s.resize(n);
    g.resize(n);
    tin.resize(n);
    tout.resize(n);
    for (int i = 0; i < n - 1; i++) {
        int x;
        cin >> x;
        x--;
        g[x].push_back(i + 1);
    }
    dfs(0);
    for (int& i : s)
        cin >> i;
    priority_queue<pair<int, int>> que;
    vector<int> pos(n);
    tour.push_back(0);
    pos[0] = 0;
    for (int i : g[0])
        que.push({ s[i], i });
    while (que.size()) {
        auto [val, x] = que.top();
        que.pop();
        pos[x] = tour.size();
        tour.push_back(x);
        for (int i : g[x])
            que.push({ s[i], i });
    }
    vector<int> pref(n + 1);
    pref[0] = 0;
    for (int i = 0; i < n; i++)
        pref[i + 1] = pref[i] + is_anc(g[0][0], tour[i]);
    for (int qs = 0; qs < q; qs++) {
        int u;
        cin >> u;
        u--;
        int ans = pos[u];
        if (is_anc(g[0][0], u)) {
            int cnt = pos[u] - pref[pos[u]] - 1;
            ans -= cnt;
        } else {
            ans -= pref[pos[u]];
        }
        cout << ans << '\n';
    }
    cout << '\n';
}

signed main()
{
#ifdef LOCAL
    freopen("TEST", "r", stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int ttt = 1;
    // cin >> ttt;
    while (ttt--)
        solve();
}
