//author: лелутик :3
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <bitset>
#include <time.h>
#include <cmath>
#include <cassert>
#include <random>
using namespace std;
#define int long long
#define line cout << "\n"
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define ppb pop_back
#define sz(a) (int) a.size()
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pii pair<int, int>
const int MAXN = 3e5 + 10;
int p[MAXN], s[MAXN];
vector<int> g[MAXN];
int num[MAXN];
int dp[MAXN];
int tin[MAXN], tout[MAXN];
int t = 1;

void dfs2(int v) {
    tin[v] = t++;
    for (auto &u : g[v]) {
        dfs2(u);
    }
    tout[v] = t++;
}


bool check_parent(int a, int b) {
    return tin[a] <= tin[b] && tout[b] <= tout[a];
}


void dfs(int v, int x) {
    if (num[v] >= x) {
        return;
    }
    dp[v] = 1;
    for (auto &u : g[v]) {
        dfs(u, x);
        dp[v] += dp[u];
    }
}


void solve() {
    int n, q;
    cin >> n >> q;
    for (int i = 1; i < n; i++) {
        cin >> p[i];
        p[i]--;
        g[p[i]].pb(i);
    }
    dfs2(0);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    int cur = 0, cnt = 0;
    set<pii> smezh;
    for (auto &u : g[0]) {
        smezh.insert({s[u], u});
    }
    while (1) {
        num[cur] = cnt;
        cnt++;
        if (sz(smezh) == 0) {
            break;
        }
        auto it = --smezh.end();
        int v = it->second;
        smezh.erase(it);
        for (auto &u : g[v]) {
            smezh.insert({s[u], u});
        }
        cur = v;
    }
    while (q--) {
        int v;
        cin >> v;
        v--;
        dfs(0, num[v]);
        int ans = num[v];
        for (int i = 0; i < n; i++) {
            if (!check_parent(i, v)) {
                ans = min(ans, num[v] - dp[i]);
            }
            dp[i] = 0;
        }
        cout << ans << " ";
    }
}

signed main() {
    fast;


#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif


    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}