#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#include <map>
#include <unordered_map>
#include <random>
#include <chrono>
// #include <bits/stdc++.h>

using namespace std;

mt19937 rng(chrono::steady_clock().now().time_since_epoch().count());

using ll = long long;
using ld = long double;

const int N = 3e5;
int s[N + 1];
vector <int> sons[N + 1];
int sz[N + 1];
int dp[N + 1], maxi[N + 1];

void dfs(int v) {
    sort(sons[v].begin(), sons[v].end(), [&] (int a, int b) {
        return s[a] > s[b];
    });
    int broMax = 0;
    int broCnt = 1;
    for (int & a : sons[v]) {
        maxi[a] = max(maxi[v], broMax);
        dp[a] = dp[v] + broCnt;
        broCnt += sz[a];
        broMax = max(broMax, sz[a]);
        dfs(a);
    }
}

void dfsSz(int v) {
    sz[v] = 1;
    for (int & u : sons[v]) {
        dfsSz(u);
        sz[v] += sz[u];
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, q;
    cin >> n >> q;
    for (int i=1; i < n; ++i) {
        int p;
        cin >> p;
        sons[p].push_back(i + 1);
    }
    for (int i=1; i <= n; ++i) {
        cin >> s[i];
    }
    dfsSz(1);
    dfs(1);
    while (q--) {
        int v;
        cin >> v;
        cout << dp[v] - maxi[v] << "\n";
    }
    return 0;
}
