#include <bits/stdc++.h>
#define int long long
#define all(v) (v).begin(), (v).end()

using namespace std;

template<class C> using vec = vector<C>;
using vi = vector<int>;
using pii = pair<int, int>;
using vpi = vec<pii>;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    int n, tt;
    cin >> n >> tt;
    vi p(n);
    vec<vi> g(n);
    for (int i = 1; i < n; i++) {
        int pr;
        cin >> pr;
        pr--;
        g[pr].push_back(i);
    }
    vi s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    vi old_s = s;
    while (tt--) {
        int u;
        cin >> u;
        u--;
        int ans = n;
        for (int i = 0; i < n; i++) {
            if(i==4){
                cout<<"";
            }
            s = old_s;
            s[i] = 0;
            vi vis(n);
            set<pii> q;
            vis[0] = true;
            q.emplace(s[0], 0);
            while (!q.empty()) {
                int v = q.rbegin()->second;
                vis[v] = true;
                if (v == u) break;
                q.erase(--q.end());
                for (auto& to : g[v]) {
                    q.emplace(s[to], to);
                }
            }
            ans = min(ans, (int)count(all(vis), true));
        }
        cout << ans - 1 << ' ';
    }
    cout << '\n';
}