#include <bits/stdc++.h>

using namespace std;
//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("avx2,avx,bmi2")
//#include "ext/pb_ds/tree_policy.hpp"
//#include "ext/pb_ds/assoc_container.hpp"
//using namespace __gnu_pbds;
//template<class T> using oredered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long

const int maxn = 3e5 + 52, inf = 8e18, mod = 1e9 + 7;

int d[maxn];
vector<vector<int>> G, g, gc;

void dfs(int s, int p, int h) {
    g[p].push_back(s);
    d[s] = h;
    for (int i : G[s]) {
        if (i != p) {
            dfs(i, s, h + 1);
        }
    }
}

void solve() {
    int n, q;
    cin >> n >> q;
    vector<int> p(n + 1);
    vector<int> s(n + 1);
    G.assign(n + 1, {});
    g.assign(n + 1, {});
    gc.assign(n + 1, {});
    for (int i = 2; i <= n; i++) {
        cin >> p[i];
        G[i].push_back(p[i]);
        G[p[i]].push_back(i);
    }
    dfs(1,0,0);
    vector<int> qu;
    for (int i = 1; i <= n; i++) cin >> s[i];
    while (q--) {
        int x;
        cin >> x;
        if (x == 1) {
            cout << "0 ";
            continue;
        }
        int res = inf;
        for (int b = 1; b <= n; b++) {
            if (b == x) continue;
            int t = 0;
            gc = g;
            vector<int> sc = s;
            sc[b] = 0;
            int k = 1;
            while (k != x) {
                int mxi = 0;
                for (int i : gc[k]) {
                    if (sc[i] > sc[mxi]) mxi = i;
                }
                for (int i : gc[k]) {
                    if (i != mxi) {
                        gc[mxi].push_back(i);
                    }
                }
                gc[k].clear();
                k = mxi;
                t++;
                if (gc[k].empty()) break;
            }
            res = min(res, t);
        }
        cout << res << ' ';
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
//    cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}
// wow1