#include <bits/stdc++.h>

using namespace std;

using ll = long long;

vector<vector<ll>> g;

ll get(int n, vector<ll> &s, int v) {
    vector<vector<ll>> gc = g;
    ll root = 0;
    ll cnt = 0;
    vector<bool> used(n, false);
    while (root != v) {
        used[root] = true;
        ll zz = -1, mx = -1;
        for (int i = 0; i < n; i++) {
            if (used[i]) continue;
            if (s[i] > mx) {
                mx = s[i];
                zz = i;
            }
        }
        vector<vector<ll>> gn(n);
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < gc[i].size(); j++) {
                if (j == root) {
                    gn[i].push_back(zz);
                    continue;
                }
                if (i == root) {
                    gn[zz].push_back(j);
                    continue;
                }
                gn[i].push_back(j);
            }
        }
        root = zz;
        cnt++;
    }
    return cnt;
}

void solve() {
    int n, q;
    cin >> n >> q;
    g.resize(n);
    for (int i = 1; i <= n - 1; i++) {
        ll p;
        cin >> p;
        p--;
        g[i].push_back(p);
        g[p].push_back(i);
    }
    vector<ll> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    for (int i = 0; i < q; i++) {
        int v;
        cin >> v;
        v--;
        ll mn = 1e9;
        for (int j = 0; j < n; j++) {
            if (j == v) continue;
            ll px = s[j];
            s[j] = -1;
            mn = min(mn, get(n, s, v));
            s[j] = px;
        }
        cout << mn << ' ';
    }
}

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