#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

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

using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pr = pair<ll, ll>;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 1;
const ll INFLL = 1e18 + 1;
int reps = 1;

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

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;

template<typename T>
inline void print(const vector<T> &a, string sep=" ") {
    for (auto &x : a) cout << x << sep;
    cout << "\n";
}

template<typename T>
inline void print(const set<T> &a, string sep=" ") {
    for (auto &x : a) cout << x << sep;
    cout << "\n";
}

template<typename T>
inline void rr(vector<T> &a, int n) {
    a.clear();
    a.resize(n);
}

//====================================

vector<vector<int>> g;
vector<int> p, ord, d, s;

int f(int v, int x) {
    if (s[v] < x) return 0;
    int res = 1;
    for (auto u : g[v]) {
        if (s[u] > x) res += f(u, x);
    }
    return res;
}

void solve() {
    int n, q; cin >> n >> q;
    rr(g, n); rr(p, n); rr(d, n); rr(s, n);
    ord.clear();
    for (int i = 1; i < n; i++) {
        cin >> p[i]; p[i]--;
        g[p[i]].push_back(i);
    }
    for (auto &x : s) cin >> x;

    priority_queue<pii> cur;
    int root = 0;
    for (int t = 0; t < n; t++) {
        ord.push_back(root);
        
        if (root != 0) {
            d[root] = d[p[root]];
            for (auto u : g[p[root]]) {
                d[root] = max(d[root], f(u, s[root]));
            }    
        }
        
        for (auto u : g[root]) {
            cur.push({s[u], u});
        }

        if (!cur.empty()) {
            auto [cd, nv] = cur.top(); cur.pop();
            root = nv;
        }

    }
    // print(d);

    for (int i = 0; i < n; i++) {
        int v = ord[i];
        d[v] = i - d[v];
    }

    while (q--) {
        int v; cin >> v; v--;
        cout << d[v] << " ";
    }
    cout << "\n";
}

//====================================

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL 
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    cin >> reps;
#endif
    for (int i = 0; i < reps; i++) {
#ifdef LOCAL 
        cout << "Test case #" << i + 1 << " ==============\n";
#endif
        solve();
#ifdef LOCAL 
        cout << "End test ==============\n";
#endif
    }
    return 0;
}

// g++ -std=c++23 -Wall -Wextra -Wshadow -DLOCAL -D_GLIBCXX_DEBUG -fsanitize=address,undefined -O2 A.cpp -o A
