#include <bits/extc++.h>
#define int long long
using namespace std;
using namespace __gnu_pbds;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, q; cin >> n >> q;
    vector<int> p(n + 1);
    for (int i = 2; i <= n; ++i) cin >> p[i];
    vector<int> s(n + 1);
    for (int i = 1; i <= n; ++i) cin >> s[i];
    vector<int> ans(n + 1, 1e18);
    vector<int> sz(n + 1);
    vector<int> g[n + 1];
    for (int i = 2; i <= n; ++i) g[p[i]].push_back(i);
    int tin[n + 1], tout[n + 1], timer = 0;
    vector<int> in(n + 1);
    function<void(int, int, int)> dfs = [&](int v, int p, int mem) {
        sz[v] = 1;
        tin[v] = timer++;
        if (v != 1 && mem == 0) mem = v;
        in[v] = mem;
        for (auto to : g[v]) {
            if (to == p) continue;
            dfs(to, v, mem);
            sz[v] += sz[to];
        }
        tout[v] = timer++;
        return;
    };
    dfs(1, 0, 0);
    auto solve = [&](int bl, vector<int> s) {
        vector<int> g[n + 1];
        for (int i = 2; i <= n; ++i) g[p[i]].push_back(i);
        s[bl] = -1;
        function<void(int, int)> dfs = [&](int v, int time) {
            ans[v] = min(ans[v], time);
            pair<int, int> mx = {-1, -1};
            for (auto to : g[v]) {
                mx = max(mx, pair<int, int>{s[to], to});
            }
            if (mx.second == -1) return;
            for (int i = 0; i < g[v].size(); ++i) {
                if (g[v][i] == mx.second) {
                    g[v].erase(g[v].begin() + i);
                    break;
                }
            }
            if (g[v].size()> g[mx.second].size()) g[v].swap(g[mx.second]);
            for (auto to : g[v]) {
                if (to != mx.second) g[mx.second].push_back(to);
            }
            g[v].clear();
            dfs(mx.second, time + 1);
            return;
        };
        dfs(1, 0);
        return;
    };
    solve(0, s);
    vector<int> real =ans;
    //for (auto to : in) cout << to << ' ';
    while (q--) {
        int v; cin >> v;
        int ans = 0;
        for (auto to : g[1]) {
            if (in[to] != in[v]) {
                if (s[to] > s[in[v]]) {
                    ans = max(ans, sz[to]);
                }
            }
        }
        cout << real[v] - ans << '\n';
    }
   /* for (int i = 1; i <= n; ++i) {
        for (auto to : g[p[i]]) {
            if (s[to] > s[i]) {
                real[i] = max(real[i], sz[to])
            }
        }
    }*/
    return 0;
}


