#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;




struct Update {
    long long add = 0;
    Update() : add(0) {}
    Update(long long add) : add(add) {}
    Update apply(Update other) {
        return add + other.add;
    }
};

struct Node {
    long long summ = 0, l = 0, r = 0;
    Node() : summ(0), l(0), r(0) {}
    Node(long long x) : summ(x) {}
    Node(long long x, long long l, long long r) : summ(x), l(l), r(r) {}
    Node merge(Node other) {
        return Node(summ + other.summ, l, other.r);
    }
    Node apply(Update other) {
        return Node(summ + other.add * (r - l), l, r);
    }
};

struct seg_tree {
    long long n;
    vector<long long> a;
    vector<Node> tree;
    vector<Update> updates;

    seg_tree(vector<long long> a2) {
        n = a2.size();
        a = a2;
        tree.resize(4 * n);
        updates.resize(4 * n);
        build(0, 0, n);
    }

    void push(long long v) {
        if (updates[v].add != 0) {
            updates[2 * v + 1] = updates[2 * v + 1].apply(updates[v]);
            updates[2 * v + 2] = updates[2 * v + 2].apply(updates[v]);
            tree[2 * v + 1] = tree[2 * v + 1].apply(updates[v]);
            tree[2 * v + 2] = tree[2 * v + 2].apply(updates[v]);
            updates[v] = 0;
        }
    }

    void build(long long v, long long l, long long r) {
        tree[v].l = l;
        tree[v].r = r;
        if (l == r - 1) {
            tree[v].summ = a[l];
            return;
        }
        long long mid = (l + r) / 2;
        build(2 * v + 1, l, mid);
        build(2 * v + 2, mid, r);
        tree[v] = tree[2 * v + 1].merge(tree[2 * v + 2]);
    }

    Node get(long long v, long long l, long long r, long long ql, long long qr) {
        if (ql <= l && r <= qr) {
            return tree[v];
        }
        if (qr <= l || r <= ql) {
            return Node();
        }
        push(v);
        long long mid = (l + r) / 2;
        return get(2 * v + 1, l, mid, ql, qr).merge(get(2 * v + 2, mid, r, ql, qr));
    }


    Node get_q(long long l, long long r) {
        return get(0, 0, n, l, r);
    }


    void update(long long v, long long l, long long r, long long ql, long long qr, Update add) {
        if (ql <= l && r <= qr) {
            tree[v] = tree[v].apply(add);
            updates[v] = updates[v].apply(add);
            return;
        }
        if (qr <= l || r <= ql) {
            return;
        }
        push(v);
        long long mid = (l + r) / 2;
        update(2 * v + 1, l, mid, ql, qr, add);
        update(2 * v + 2, mid, r, ql, qr, add);
        tree[v] = tree[2 * v + 1].merge(tree[2 * v + 2]);
    }

    void update_q(long long l, long long r, long long add) {
        update(0, 0, n, l, r, add);
    }
};

struct pt {
    long long x, y;
    pt() : x(0), y(0) {}
    pt(long long x, long long y) : x(x), y(y) {}
    pt(pt s, pt t) : x(t.x - s.x), y(t.y - s.y) {}

    long long operator*(pt other) {
        return x * other.y + y * other.x;
    }
    long long operator%(pt other) {
        return x * other.y - y * other.x;
    }

    pt operator*(long long k) {
        return pt(x * k, y * k);
    }

    pt operator+(pt other) {
        return pt(x + other.x, y + other.y);
    }

    pt operator-(pt other) {
        return pt(x - other.x, y - other.y);
    }
};

struct line {
    long long a, b, c;
    line() : a(0), b(0), c(0) {}
    line(pt s, pt t) {
        a = t.y - s.y;
        b = s.x - t.x;
        c = -(t.y * s.x - t.x * s.y);
        //(t.y - s.y) * t.x + (s.x - t.x) * t.y = -s.y * t.x + s.x * t.y
        //(t.y - s.y) * s.x + (s.x - t.x) * s.y = t.y * s.x - t.x * s.y
    }

    bool is_on_line(pt other) {
        return other.x * a + other.y * b + c == 0;
    }
};

vector<vector<long long>> g_new;
long long ask_now = 0, best = 0;

pair<long long, bool> dfs(long long v) {
    long long sz = 1;
    //cout << v << endl;
    bool has = false;
    if (v == ask_now) {
        has = true;
    }
    for (auto &i : g_new[v]) {
        auto now = dfs(i);
        has |= now.second;
        sz += now.first;
    }
    if (!has && best < sz) {
        best = sz;
    }
    return {sz, has};
}
signed main() {
    //freopen("input.txt", "r", stdin);
    long long n, q;
    cin >> n >> q;
    g_new.resize(n);
    vector<vector<long long>> g(n);
    vector<long long> s(n), p(n);
    for (long long i = 1; i < n; i++) {
        long long x;
        cin >> x;
        x--;
        p[i] = x;
        g[x].push_back(i);
    }
    for (auto &i : s) {
        cin >> i;
    }
    vector<long long> time_normally(n);
    long long now = 0;
    vector<set<pair<long long, long long>>> g_set(n);
    for (long long i = 0; i < n; i++) {
        for (auto &j : g[i]) {
            g_set[i].insert({s[j], j});
        }
    }
    set<pair<long long, long long>> going_now;
    for (auto &i : g[0]) {
        going_now.insert({s[i], i});
    }
    //cout << "HEHEH" << endl;
    vector<long long> seq = {0};
    while (!going_now.empty()) {
        //cout << now << " " << going_now.size() << endl;
        long long new_ = going_now.rbegin()->second;
        seq.push_back(new_);
        going_now.erase({s[new_], new_});
        if (going_now.size() < g_set[new_].size()) {
            swap(going_now, g_set[new_]);
        }
        for (auto &i : g_set[new_]) {
            going_now.insert(i);
        }
        time_normally[new_] = time_normally[now] + 1;
        now = new_;
    }
    //cout << "E" << endl;
    //return 0;
    //DO NOT FORGET TO STORE AFTER WRITING
    vector<long long> ind_ask(n, -1);;
    vector<long long> ans(q);
    for (long long i = 0; i < q; i++) {
        long long v;
        cin >> v;
        v--;
        ind_ask[v] = i;
        //cout << "HIII" << endl;
    }
    //cout << seq.size() << endl;
    long long cnt = 0;
    for (auto &i : seq) {
        if (i != 0) {
            g_new[p[i]].push_back(i);
        }
        if (ind_ask[i] == -1) {
            cnt++;
            continue;
        }
        best = 0;
        ask_now = i;
        dfs(0);
        //cout << "HHH" << endl;
        ans[ind_ask[i]] = cnt - best;
        if (i == 0) {
            ans[ind_ask[i]] = 0;
        }
        cnt++;
        //cout << i << " ";
    }
    //cout << endl;
    //cout << "BU" << endl;
    for (auto &i : ans) {
        cout << i << " ";
    }
    cout << endl;
}

