#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<stack>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>

using namespace std;
using ll = long long int;
using ld = long double;

vector<vector<int>> graph;
vector<int> p, s;
vector<int> tin, tout;
vector<int> path;
vector<vector<int>> pathes;
int cnt = 0, C = 0;

void dfs(int v, int p = -1) {
    tin[v] = cnt++;
    if (p == -1) {
        path[v] = C++;
        pathes.push_back({});
        pathes[path[v]].push_back(s[v]);
    } else {
        path[v] = path[p];
        pathes[path[v]].push_back(s[v]);
    }
    for (auto elem : graph[v]) {
        if (elem != p) {
            dfs(elem, v);
        }
    }
    tout[v] = cnt++;
}

void solve() {
    int n, q;
    cin >> n >> q;
    graph.resize(n);
    p.resize(n, -1);
    tin.resize(n);
    tout.resize(n);
    for (int i = 1; i < n; ++i) {
        int u;
        cin >> u;
        --u;
        graph[u].push_back(i);
        graph[i].push_back(u);
        p[i] = u;
    }
    dfs(0);
    for (int i = 0; i < C; ++i) {
        sort(pathes[i].begin(), pathes[i].end());
    }
    s.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }
    set<pair<int, int>> S;
    vector<int> order;
    S.insert(make_pair(-s[0], 0));
    int w = 0;
    vector<int> ind(n, 0);
    while (!S.empty()) {
        auto t = *S.begin();
        S.erase(S.begin());
        order.push_back(t.second);
        ind[t.second] = w++;
        for (auto elem : graph[t.second]) {
            if (elem != p[t.second]) {
                S.insert({-s[elem], elem});
            }
        }
    }
    for (int _ = 0; _ < q; ++_) {
        int u;
        cin >> u;
        u -= 1;
        if (u == 0) {
            cout << "0 ";
        } else {
            cout << ind[u] - (pathes[1 - path[u]].end() - upper_bound(pathes[1 - path[u]].begin(), pathes[1 - path[u]].end(), s[u])) << " ";
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int tt = 1;
    while (tt--) {
        solve();
    }
}