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

using namespace std;
using namespace __gnu_pbds;
using ll = long long;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

//int new_tnode(ll x, int tl, int tr, int l = 0, int r = 0);

template<class T>
struct TNode {
    T x;
    int tl, tr;
    int l = 0;
    int r = 0;
    T def;
    function<T(T, T)> sum;

    TNode(T x, T def, function<T(T, T)> sum, int tl, int tr, int l = 0, int r = 0) :
            x(x), def(def), sum(sum), tl(tl), tr(tr), l(l), r(r) {

    }
    // TNode() = default;
    TNode get_l() const {
        return l ? l : TNode<T>(def, tl, (tl + tr) / 2);
    }
    TNode get_r() const {
        return r ? r : TNode<T>(def, (tl + tr) / 2, tr);
    }

    T get(int ll, int rr) {
        if (tr <= ll || rr <= tl) return def;
        if (ll <= tl && tr <= rr) return x;
        return sum(get_l().get(ll, rr), get_r().get(ll, rr));
    }

    void insert(int i, T y) {
        if (tl == i && i + 1 == tr) {
            x = y;
        }
        int tm = (tl + tr) / 2;
        if (i < tm) {
            get_l().insert(i, y);
        } else {
            get_r().insert(i, y);
        }
        x = sum(get_l().x, get_r().x);
    }

};

//vector<TNode> tn(1);

//int new_tnode(ll x, int tl, int tr, int l, int r) {
//    tn.emplace_back(x, tl, tr, l, r);
//    return (int) tn.size() - 1;
//}

//template<class T>
//struct Tree {
//    TNode<T> root;
//    int n, N;
//    T def;
//    function<T(T, T)> sum;
//    Tree(int n, T def, function<T(T, T)> sum): n(n), def(def), sum(sum) {
//        int st = 0;
//        while ((1 << st) < n) ++st;
//        N = (1 << st);
//        root = TNode<T>(def, sum, 0, N);
//    }
//};

int n;
vector<int> p;
vector<vector<int>> g;
vector<int> c;

pair<int, int> gfs(int v, int x) {
    x = min(x, c[v]);
    pair<int, int> res = pair(0, 0);
    for (int u: g[v]) {
        if (c[u] > x) {
            auto [a, b] = gfs(u, x);
            res = {res.first + a + 1, min(res.second + a + 1, res.first)};
        }
    }
    return res;
}

pair<int, int> dfs(int v, int x, int pr) {
    x = min(x, c[v]);
    pair<int, int> res = v == 0 ? pair(0, 0) : dfs(p[v], x, v);
    res.first++;
    res.second++;
    for (int u: g[v]) {
        if (c[u] > x && u != pr) {
            auto [a, b] = gfs(u, x);
            res = {res.first + a + 1, min(res.second + a + 1, res.first)};
        }
    }
    return res;
}


void solve() {
    cin >> n;
    g.resize(n);
    p.assign(n, -1);
    c.resize(n);
    int q;
    cin >> q;
    for (int i = 1; i < n; ++i) {
        cin >> p[i];
        --p[i];
        g[p[i]].push_back(i);
    }
    for (int i = 0; i < n; ++i) {
        cin >> c[i];
    }
    for (int qq = 0; qq < q; ++qq) {
        int v;
        cin >> v;
        --v;
        int res = 0;
        if (v != 0) {
            res = dfs(p[v], c[v], v).second;
        }
        cout << res << ' ';
    }
}

int main() {
    int t = 1;
//    cin >> t;
    for (int test = 0; test < t; ++test) {
        solve();
        cout << '\n';
    }
    cerr << clock() / 1000.0;
    return 0;
}
