#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;
    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);
    }
    dfs1(0);
    vector<int> nums(n);
    for (int i=0; i<n; i++) cin >> nums[i];


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

        int iter = 0;
        priority_queue<pii> q;
        vector<int> cntbad(n);
        vector<int> pidor(n, -1);
        q.push({nums[0], 0});
        while (sz(q)) {
            auto [val, x] = q.top();
            q.pop();

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

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


    return 0;
}