#include <bits/stdc++.h>
using namespace std;
#ifdef _LOCAL
#define debug(x) cout << __LINE__ << ' ' << __PRETTY_FUNCTION__ << ": " << (x) << endl
#else
#define debug(...) 238;
#endif
mt19937 rng(238);
mt19937_64 rng64(238);
using ll = long long;
template <typename T, int U>
using ar = array<T, U>;
template <typename T, typename U>
bool chmin(T& x, const U&& y) {
    if (x > y) {
        x = y;
        return true;
    }
    return false;
}
template <typename T, typename U>
bool chmax(T& x, const U&& y) {
    if (x < y) {
        x = y;
        return true;
    }
    return false;
}

#include <ext/pb_ds/assoc_container.hpp>
template <typename T>
using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type,
                                     less<T>,
                                     __gnu_pbds::rb_tree_tag,
                                     __gnu_pbds::tree_order_statistics_node_update>; 
constexpr int Inf = 0x3f3f3f3f;
constexpr ll inf = 1144000000000000000;


const int maxn = 300005;
vector<int> g[maxn];
int s[maxn], subt[maxn], tin[maxn], tout[maxn];
bool vis[maxn];
void precalc(int v) {
    static int timer = 0;
    tin[v] = timer++;
    for (int u : g[v]) {
        precalc(u);
    }
    tout[v] = timer;
}
bool is_anc(int v, int u) {
    return tin[u] >= tin[v] && tout[u] <= tout[v];
}
int accum(int v) {
    for (int u : g[v]) {
        accum(u);
        subt[v] += subt[u];
    }
    subt[v] += vis[v];
}
int dfs(int v, int target) {
    if (!is_anc(v, target) || subt[v] == 0) {
        return subt[v];
    }
    int under = 0;
    for (int u : g[v]) {
        under = max(under, dfs(u, target));
    }
    return under;
}

void solve() {
    int n, q;
    cin >> n >> q;
    for (int p, i = 1; i < n; ++i) {
        cin >> p;
        --p;
        g[p].push_back(i);
    }
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }
    precalc(0);

    while (q--) {
        int target;
        cin >> target;
        --target;

        memset(vis, 0, n * (sizeof vis[0]));
        memset(subt, 0, n * (sizeof subt[0]));

        priority_queue<pair<int, int>> pq;
        pq.emplace(s[0], 0);
        int t = 0;
        while (pq.top().second != target) {
            auto [prior, key] = pq.top();
            pq.pop();
            vis[key] = true;
            for (int v : g[key]) {
                pq.emplace(s[v], v);
            }
            t++;
        }

        accum(0);
        cout << t - dfs(0, target) << ' ';
    }
}

int main() {
#ifdef _LOCAL
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout);
    freopen("test.out", "w", stderr);
#endif
    cin.tie(0)->sync_with_stdio(0);

    int Tc = 1;
    // cin >> Tc;
    while (Tc--) {
        solve();
        cout << '\n';
    }

    return 0;
}