#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>
#include <ctime>
#include <random>
#include <map>
#include <set>
#define ll long long
#define nl '\n'
#define emp emplace_back
#define all(x) x.begin(), x.end()
#define pll pair<ll, ll>
#define pii pair<int, int>
#define popcnt __builtin_popcount
#define ffs __builtin__ffs
#define ss second
#define ff first
//#include <ext/pb_ds/assoc_container.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("avx");
//#pragma GCC target("avx2");

using namespace std;
//using namespace __gnu_pbds;

//typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll INF = 1e18;

const ll mod = 998244353;

mt19937 rnd(time(nullptr));

template<typename T>
istream &operator >>(istream &in, vector<T> &arr) {
    for (auto &x : arr) {
        in >> x;
    }
    return in;
}

template<typename T>
ostream &operator <<(ostream &out, vector<T> &arr) {
    for (auto &x : arr) {
        out << x << ' ';
    }
    out << '\n';
    return out;
}

ll n, q;
vector<vector<ll>> g;
vector<ll> s, sz;
multiset<ll> st;
ll ans = 0;

bool dfs(ll u, ll mn, ll p) {
    ++ans;
    if (u == p) {
        return true;
    }
    sz[u] = 1;
    bool fl = false;
    for (auto v : g[u]) {
        if (s[v] >= mn) {
            fl |= dfs(v, mn, p);
            sz[u] += sz[v];
        }
    }
    if (!fl) st.insert(sz[u]);
    return fl;
}

bool comp(const ll &i1, const ll &i2) {
    return s[i1] > s[i2];
}

vector<ll> mn;

void calc(ll u, ll p = INF) {
    p = min(p, s[u]);
    mn[u] = p;
    for (auto v : g[u]) {
        calc(v, p);
    }
}

void solve() {
    cin >> n >> q;
    g.resize(n);
    s.resize(n);
    mn.resize(n);
    sz.resize(n);
    for (ll i = 1; i < n; ++i) {
        ll p;
        cin >> p;
        --p;
        g[p].emp(i);
    }
    cin >> s;
    for (auto &x : g) {
        sort(all(x), comp);
    }
    calc(0);
    while (q--) {
        ll x;
        cin >> x;
        ans = 0;
        st.clear();
        st.insert(0);
        dfs(0, mn[x - 1], x - 1);
        cout << ans - *(--st.end()) - 1 << ' ';
    }
}

int main() {
#ifdef CLOCK
    ll time1 = clock();
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    ll tpk = 1;

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    cin >> tpk;
#endif

    while (tpk--) {
        solve();
        cout << nl;
    }

#ifdef CLOCK
    cout << clock() - time1 << " ms";
#endif
}