#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define all(x) x.begin(), x.end()
#define ff first
#define ss second

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using pii = pair<int, int>;

vector<vector<ll>> g;
vector<ll> a;

ll ans;

ll curt = 0;

vector<ll> tin, tout;

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

void dfs0(ll v) {
    tin[v] = curt++;
    for (ll child : g[v]) {
        dfs0(child);
    }
    tout[v] = curt++;
}

ll calc(ll cur, ll ban) {
    set<pll, greater<pll>> s;
    s.emplace(a[0], 0);
    ll cand = 0;
    bool found = false;
    while (!s.empty()) {
        ll v = s.begin()->second;
        s.erase(s.begin());
        if (v == cur) {
            found = true;
            break;
        }
        ++cand;
        for (ll child : g[v]) {
            if (child != ban) {
                s.emplace(a[child], child);
            }
        }
    }
    return cand;
}

void dfs(ll v, ll cur) {
    for (ll child : g[v]) {
        if (is_pred(child, cur)) {
            // dfs(child, cur);
        } else {
            ans = min(ans, calc(cur, child));
        }
    }
}

signed main() {
    // freopen("inputc.txt", "r", stdin);
    ll n, q;
    cin >> n >> q;
    g.resize(n);
    a.resize(n);
    tin.resize(n);
    tout.resize(n);
    vector<ll> par(n);
    for (ll i = 1; i < n; ++i) {
        ll p;
        cin >> p;
        --p;
        g[p].push_back(i);
        par[i] = p;
    }
    for (ll i = 0; i < n; ++i) {
        cin >> a[i];
    }
    dfs0(0);
    for (ll i = 0; i < q; ++i) {
        ll cur;
        cin >> cur;
        --cur;
        ans = calc(cur, 0);
        dfs(0, cur);
        cout << ans << endl;
    }
}
