#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;

using namespace __gnu_pbds;

using ll = long long;

using ordered_set = tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;

ll LNF = 1e18 + 1;
ll INF = 1e9 + 1;


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

template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2> & a) {
    in >> a.first >> a.second;
    return in;
}


string SEP = " ";

template <typename T>
ostream& operator<<(ostream & out, vector<T> a) {
    for (T x : a) out << x << SEP;
    return out;
}

template <typename T1, typename T2>
ostream& operator<<(ostream & out, pair<T1, T2> a) {
    out << a.first << SEP << a.second << SEP;
    return out;
}


template <typename T1, typename T2>
bool MA(T1 & a, T2 b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T1, typename T2>
bool MI(T1 & a, T2 b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}


ll MD(ll a, ll M) {
    if (a >= 0) {
        if (a < M)
            return a;
        a -= M;
        if (a < M)
            return a;
        return a % M;
    }
    a += M;
    if (a >= 0)
        return a;
    return ((a % M) + M) % M;
}


ll BP(ll a) {
    return a * a;
}

ll BP(ll a, ll n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        ll x = BP(a, n / 2);
        return x * x;
    }
    return BP(a, n - 1) * a;
}

ll BP(ll a, ll n, ll M) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        ll x = BP(a, n / 2, M);
        return MD(x * x, M);
    }
    return MD(BP(a, n - 1, M) * a, M);
}






ll n, q;
vector<vector<ll>> g;
vector<ll> a, t;

vector<ll> dp;
ll dp_best;

ll uq;

void dfs_dp(ll u, ll x) {
    dp[u] = (a[u] <= x);
    if (u == uq) {
        dp[u] = -INF;
        return;
    }
    for (ll v : g[u]) {
        dfs_dp(v, x);
        dp[u] += dp[v];
    }
    if (dp[u] < 0) dp[u] = -INF;
    MA(dp_best, dp[u]);
}

bool ok(ll x) {
    dp.assign(n, 0);
    dp_best = 0;
    dfs_dp(0, x);
    return t[uq] - dp_best <= x;
}

void CASE(ll CASE_ID) {
    cin >> n >> q;
    g.assign(n, {});
    for (ll v = 1; v < n; ++v) {
        ll u;
        cin >> u;
        --u;
        g[u].push_back(v);
    }
    a.assign(n, 0);
    cin >> a;

    t.assign(n, 0);
    set<pair<ll, ll>> cur;
    for (ll v : g[0]) cur.emplace(a[v], v);
    ll curt = 0;
    while (!cur.empty()) {
        ll u = (--cur.end())->second;
        cur.erase(--cur.end());
        ++curt;
        t[u] = curt;
        for (ll v : g[u]) {
            cur.emplace(a[v], v);
        }
    }

    while (q--) {
        cin >> uq;
        --uq;
        ll L = -1, R = t[uq];
        while (R - L > 1) {
            ll M = (L + R) / 2;
            (ok(M) ? R : L) = M;
        }
        cout << R << ' ';
    }
}


void IOF() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

signed main() {
    IOF();

    bool MULTITEST = (ll)0;
    ll T = 1;
    if (MULTITEST)
        cin >> T;
    for (ll i = 0; i < T; ++i) {
        CASE(i);
        cout << '\n';
    }

    exit('U' ^ 'U');
}

// Powered by: Mi Notes
