#include "bits/extc++.h"

using namespace std;
using namespace __gnu_pbds;

using ll = long long;

template<typename T>
istream &operator>>(istream &is, vector<T> &a);

template<typename T>
ostream &operator<<(ostream &os, vector<T> &a);


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

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif

    ll n, q;
    cin >> n >> q;

    vector<int> par(n, -1);
    vector<vector<int>> g(n);
    for (int i = 0; i < n - 1; ++i) {
        int p;
        cin >> p;
        p--;
        if (p == 0) par[i+1] = i+1;
        else par[i+1] = par[p];
        g[p].push_back(i + 1);
        g[i + 1].push_back(p);
    }

    vector<int> s(n);
    cin >> s;

    function<void(int, int, int)> dfs = [&](int v, int prev, int val) {
        int cval = min(val, (v == 0 ? (int) 1e9 : s[v]));
        s[v] = cval;
        for (auto u: g[v]) {
            if (u == prev) continue;
            dfs(u, v, cval);
        }
    };
    dfs(0,0,n);

    vector<vector<int>> ques(n);
    for (int i = 0; i < q; ++i) {
        int v;
        cin >> v;

        ques[v-1].push_back(i);
    }

    vector<vector<int>> by_s(n+1);
    for (int i = 0; i < n; ++i) {
        by_s[s[i]].push_back(i);
    }

    multiset<int> vals;
    for (int i = 0; i < n; ++i) {
        if (par[i] == i) vals.insert(0);
    }
    vector<int> cnt(n);
    ll ans = 0;
    vector<int> res(q);
    int count = 0;
    for (int ss = n; ss >= 0; --ss) {
        for (auto v: by_s[ss]){
            for (auto time: ques[v]){
                if (v==0){
                    res[time]=0;
                } else {
                    vals.extract(cnt[par[v]]);
                    if (vals.empty()) res[time] = count + 1;
                    else res[time] = count - *vals.rbegin() + 1;
                    vals.insert(cnt[par[v]]);
                }
            }
        }
        for (auto v: by_s[ss]){
            if (v == 0) continue;

            count++;
            vals.extract(cnt[par[v]]);
            cnt[par[v]]++;
            vals.insert(cnt[par[v]]);
        }
    }

    for (int i = 0; i < q; ++i) {
        cout << res[i] << "\n";
    }
}

template<typename T>
istream &operator>>(istream &is, vector<T> &a) {
    for (auto &v: a) is >> v;
    return is;
}

template<typename T>
ostream &operator<<(ostream &os, vector<T> &a) {
    for (auto v: a) os << v << " ";
    return (os << "\n");
}
