#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ld = long double;
template <typename T>
ll sz(T& a) {
    return (ll)a.size();
}


vector<vector<int>> g;
int timer = 0;
vector<int> tin, tout;
void dfs1(int v) {
    tin[v] = timer++;
    for (int nxt:g[v]) dfs1(nxt);
    tout[v] = timer++;
}
bool check(int a, int b) {
    return tin[a]<=tin[b] && tout[a]>=tout[b];
}


int main() {
//    cout.setf(ios::fixed); cout.precision(15);
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#ifdef manix888
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif


    int n, qq;
    cin >> n >> qq;
    vector<int> pred(n, -1);
    g.resize(n); tin.resize(n); tout.resize(n);
    for (int i=1; i<n; i++) {
        int x; cin >> x; x--;
        g[x].push_back(i);
        pred[i] = x;
    }
    vector<int> nums(n);
    for (int i=0; i<n; i++) cin >> nums[i];

    for (int i=0; i<n; i++) {
        sort(g[i].begin(), g[i].end(), [&](int a, int b){
            return nums[a] > nums[b];
        });
    }
    dfs1(0);


    while (qq--) {
        int v; cin >> v; v--;
        if (v==0) {cout << 0 << ' '; continue;}

        int minv = nums[v];
        int tmp1 = v;
        while (pred[tmp1] != 0) {
            tmp1 = pred[tmp1];
            minv = min(minv, nums[tmp1]);
        }

        int iter = 0;
        queue<int> q;
        vector<int> cntbad(n);
        vector<int> pidor(n, -1);
        q.push(0);
        while (sz(q)) {
            int x = q.front();
            iter++;
            q.pop();

            if (x==v) continue;
            if (pidor[x]!=-1) cntbad[pidor[x]]++;
            for (int nxt:g[x]) {
                if (nums[nxt]<minv) continue;
                if (pidor[x]!=-1) pidor[nxt] = pidor[x];
                else {
                    if (check(nxt, v) == 0) pidor[nxt] = nxt;
                }
                q.push(nxt);
            }
        }

        int ans = iter - *max_element(cntbad.begin(), cntbad.end()) - 1;
        cout << ans << ' ';
    }


    return 0;
}