#include <bits/stdc++.h>

using namespace std;
#define int long long

vector<vector<int>> g;

signed main() {
    int n, q;
    cin >> n >> q;
    g.resize(n);
    for (int i = 1; i < n; ++i) {
        int p;
        cin >> p;
        --p;
        g[p].push_back(i);
    }
    vector<int> s(n);
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }
    for (int i = 0; i < q; ++i) {
        int v;
        cin >> v;
        --v;
        int ans = 1e9;
        for (int j = 0; j < n; ++j) {
            int s1 = s[j];
            s[j] = 0;

            set<pair<int, int>, greater<>> a;
            a.insert({s[0], 0ll});
            int res = 0;
            while (a.begin()->second != v) {
                ++res;
                auto [z, x] = *a.begin();
                a.erase(a.begin());
                for (auto u: g[x]) {
                    a.insert({s[u], u});
                }
            }
            ans = min(res, ans);

            s[j] = s1;
        }
        cout << ans << "\n";
    }
    return 0;
}
