#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll n, q;
vector<ll> p;
vector<vector<ll>> g;
vector<ll> s;
vector<tuple<ll, ll, ll>> qs;
vector<ll> ans;
vector<ll> sz;
vector<ll> szdown1;
vector<ll> szdown2;

int main(int, char**) {
    cout << setprecision(15) << fixed;
#ifdef DEBUGMB
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#endif

    cin >> n >> q;
    p.assign(n, -1);
    g.resize(n);
    sz.assign(n, 0);
    szdown1.assign(n, 0);
    szdown2.assign(n, 0);
    s.resize(n);
    ans.resize(q);
    qs.resize(q);
    for (ll i = 1; i < n; ++i) {
        cin >> p[i];
        p[i]--;
        g[p[i]].emplace_back(i);
    }
    for (ll i = 0; i < n; ++i) {
        cin >> s[i];
    }
    map<ll, ll> mp;
    for (ll i = 0; i < q; ++i) {
        cin >> get<1>(qs[i]);
        get<1>(qs[i])--;
        get<0>(qs[i]) = s[get<1>(qs[i])];
        get<2>(qs[i]) = i;
        mp[get<1>(qs[i])] = i;
    }
    sort(qs.rbegin(), qs.rend());
    set<pair<ll, ll>> que;
    que.insert({ s[0], 0 });
    ll cnt = 0;
    while (!que.empty()) {
        auto [ss, v] = *(--que.end());
        que.erase(--que.end());
        cnt++;
        ll res;
        ll u = v;
        sz[u]++;
        ll biggest = 0;
        while (p[u] != -1) {
            sz[p[u]]++;
            if (sz[u] > szdown1[p[u]]) {
                szdown1[p[u]] = sz[u];
            } else if (sz[u] == szdown1[p[u]]) {
                szdown2[p[u]] = sz[u];
            } else if (sz[u] >= szdown2[p[u]]) {
                szdown2[p[u]] = sz[u];
            }
            biggest = max(biggest, (sz[u] == szdown1[p[u]] ? szdown2[p[u]] : szdown1[p[u]]));
            u = p[u];
        }
        if (mp.find(v) != mp.end()) {
            ans[mp[v]] = cnt - biggest - 1;
        }

        for (auto to : g[v]) {
            que.insert({s[to], to});
        }
    }
    for (auto el : ans) {
        cout << el << " ";
    }




    return 0;
}
