#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#define LOCAL

// std::mt19937 rnd(time(0));

void solve();

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

#ifdef LOCAL
    std::freopen("input.txt", "r", stdin);
    std::freopen("output.txt", "w", stdout);
#endif

    int t = 1;
    // std::cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}

std::vector <std::vector <int>> edges;
std::vector <int> parents;
std::vector <int> s;

std::map <int, int> quest;
std::vector <int> res;
std::vector <int> weight;

class V {
 public:
    int id;
    int val;

    bool operator < (const V& other) const {
        return val < other.val;
    }
};

inline int calc(int curV, int prevV, int curS) {
    if (s[curV] <= curS) return 0;

    int r = 1;

    for (auto nextV : edges[curV]) {
        if (nextV == prevV) continue;

        r += calc(nextV, curV, curS);
    }

    return r;
}

void solve() {
    int n, q;
    std::cin >> n >> q;

    parents.resize(n, -1);

    edges.resize(n);
    for (int i = 1; i < n; ++i) {
        int p;
        std::cin >> p;

        --p;

        edges[i].push_back(p);
        edges[p].push_back(i);

        parents[i] = p;
    }

    s.resize(n);
    for (int i = 0; i < n; ++i) {
        std::cin >> s[i];
    }

    if (q <= 200) {
        for (int i = 0; i < q; ++i) {
            int u;
            std::cin >> u;

            --u;

            int min = s[u];

            int maxD = 0;

            long long size = 0;

            int curV = u;
            while (parents[curV] != -1) {
                for (auto nextV : edges[parents[curV]]) {
                    if (nextV == curV || nextV == parents[parents[curV]]) continue;
                    int curC = calc(nextV, parents[curV], min);
                    size += curC;
                    maxD = std::max(maxD, curC);
                }
                min = std::min(min, s[parents[curV]]);
                curV = parents[curV];
                size += 1;
            }

            std::cout << size - maxD << ' ';
        }
        return;
    }

    for (int i = 0; i < q; ++i) {
        int u;
        std::cin >> u;

        --u;

        quest[u] = i;
        res.push_back(0);
    }

    std::priority_queue <V> inProcess;
    inProcess.push({0, s[0]});

    res.resize(q);
    weight.resize(n, 0);

    while (!inProcess.empty()) {
        V top = inProcess.top();
        inProcess.pop();

        if (quest.find(top.id) != quest.end()) {
            int maxDel = 0;
            int curV = top.id;
            while (parents[curV] != -1) {
                for (auto nextV : edges[parents[curV]]) {
                    if (nextV == curV || nextV == parents[parents[curV]]) continue;
                    maxDel = std::max(maxDel, weight[nextV]);
                }
                curV = parents[curV];
            }
            res[quest[top.id]] = weight[0] - maxDel;
        }

        int curV = top.id;
        while (curV != -1) {
            weight[curV] += 1;
            curV = parents[curV];
        }

        for (auto nextV : edges[top.id]) {
            if (nextV == parents[top.id]) continue;

            inProcess.push({nextV, s[nextV]});
        }
    }

    for (auto i : res) {
        std::cout << i << '\n';
    }
}
