#ifndef LOCAL
#include <bits/allocator.h>
#pragma GCC optimize("O3,unroll-loops,no-stack-protector")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt,tune=native")
#else
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i128 = __int128_t;

#define all(x) (x).begin(), (x).end()

const int MAX_N = 3e5;

vector<int> graph[MAX_N];
int lvl[MAX_N], queries[MAX_N], normal_time[MAX_N], par[MAX_N];

void solve() {
    int n, q;
    cin >> n >> q;
    par[0] = -1;
    for (int i = 1; i < n; ++i) {
        int p;
        cin >> p;
        --p;
        par[i] = p;
        graph[p].push_back(i);
    }
    for (int i = 0; i < n; ++i) {
        cin >> lvl[i];
    }
    for (int i = 0; i < q; ++i) {
        cin >> queries[i];
        --queries[i];
    }
    priority_queue<pair<int, int>> que;
    que.emplace(0, 0);
    int curr_time = 0;
    while (!que.empty()) {
        int v = que.top().second;
        normal_time[v] = curr_time++;
        que.pop();
        for (int x : graph[v]) {
            que.emplace(lvl[x], x);
        }
    }
    for (int qi = 0; qi < q; ++qi) {
        int qv = queries[qi];
        int ans = 1e9;
        if (qv == 0) {
            ans = 0;
        }
        int v_ch = qv;
        for (int v = par[qv]; v != -1; v = par[v], v_ch = par[v_ch]) {
            for (int x : graph[v]) {
                if (x == v_ch)
                    continue;
                int subtree_cnt = 0;
                vector<int> st{x};
                while (!st.empty()) {
                    int v1 = st.back();
                    st.pop_back();
                    subtree_cnt += normal_time[v1] < normal_time[qv];
                    for (int x1 : graph[v1]) {
                        st.push_back(x1);
                    }
                }
                ans = min(ans, normal_time[qv] - subtree_cnt);
            }
        }
        cout << ans << " ";
    }
    cout << "\n";
}

int main() {
#ifndef LOCAL
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
}