#include <bits/stdc++.h>

using namespace std;

using ll = long long;

#define int long long

const int MAX = 3e5 + 7;

vector<int> g[MAX];
int tin[MAX], tout[MAX];
int n, q;
int pr[MAX];
int a[MAX];
int res[MAX];
int mn[MAX];
int up[MAX][20];

int f[MAX];
bool need[MAX];
int rq[MAX];

void add(int p, int x) {
    for (; p <= n; p += p & -p) {
        f[p] += x;
    }
}

int sum(int p) {
    int ret = 0;
    for (; p > 0; p -= p & -p) ret += f[p];
    return ret;
}

int sum(int l, int r) {
    return sum(r) - sum(l - 1);
}

int timer = 0;

bool good(int aa, int b) {
    return (tin[aa] <= tin[b] && tout[aa] >= tout[b]);
}

void dfs1(int v, int p = 1) {
    tin[v] = ++timer;
    for (auto to : g[v]) {
        dfs1(to, v);
    }
    tout[v] = timer;
}

void solve() {
    cin >> n >> q;
    for (int i = 1; i <= n; i++) {
        res[i] = n + 1;
    }
    for (int i = 2; i <= n; i++) {
        int p;
        cin >> p;
        pr[i] = p;
        g[p].push_back(i);
    }
    dfs1(1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    res[1] = 0;
    for (int i = 1; i <= q; i++) {
        cin >> rq[i];
        need[rq[i]] = 1;
    }
    int ptr = 0;
    set<pair<int, int>> st;
    st.insert({a[1], 1});
    while ((int)(st.size())) {
        int v = (*--st.end()).second;
        st.erase(--st.end());
        add(tin[v], 1);
        int del = 0;
        int now = v;
        if (need[v]) {
            while (now != 1) {
                for (auto to : g[pr[now]]) {
                    if (to != now) {
                        del = max(del, sum(tin[to], tout[to]));
                    }
                }
                now = pr[now];
            }
//            cout << v << ' ' << del << '\n';
            res[v] = min(res[v], ptr - del);
        }
        ptr++;
        for (auto to : g[v]) {
            st.insert({a[to], to});
        }
    }
    for (int i = 1; i <= q; i++) {
        cout << res[rq[i]] << ' ';
    }
}

int32_t main() {
#ifdef __APPLE__
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0); cin.tie(0);
    int tt = 1;
//     cin >> tt;
    while (tt--) {
        solve();
    }
}