#include <bits/stdc++.h>
#define int long long

using namespace std;

vector <vector <int>> arr1;
vector <int> s1;
int V;
int cnt;

void go(int root) {
    if (root == V) {
        return;
    }
    int maxv = arr1[root][0];
    for (int v : arr1[root]) {
        if (s1[v] > s1[maxv]) maxv = v;
    }
    for (int v : arr1[root]) {
        if (v != maxv) arr1[maxv].push_back(v);
    }
    cnt++;
    go(maxv);
}

signed main() {
    int n, q;
    cin >> n >> q;
    vector <vector <int>> arr(n);
    for (int i = 1; i < n; ++i) {
        int p;
        cin >> p;
        p--;
        arr[p].push_back(i);
    }
    vector <int> s(n);
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }
    while (q--) {
        cin >> V;
        V--;
        int ans = 1e9;
        for (int i = 0; i < n; ++i) {
            if (i != V) {
                arr1 = arr;
                s1 = s;
                s1[i] = 0;
                cnt = 0;
                go(0);
                ans = min(ans, cnt);
            }
        }
        cout << ans << endl;
    }
    return 0;
}
