#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> s, dp, num, p;
vector<vector<int>> det;

void dfs(int v, int par = -1) {
    //cout << v << " " << graph[v].size() << " " << graph[v][0] << " " << par << endl;
    if ((int)graph[v].size() == 1 && graph[v][0] == par) {
        dp[v] = 1;
        det[v] = {s[v]};
        return;
    }
    for (auto elem : graph[v]) {
        if (elem != par) {
            dfs(elem, v);
            dp[v] += dp[elem];
            for (auto elem1 : det[elem]) {
                det[v].push_back(elem1);
            }
        }
    }
    det[v].push_back(s[v]);
    sort(det[v].begin(), det[v].end());
    dp[v]++;
}

void solve() {
    int n, q;
    cin >> n >> q;
    s.resize(n);
    dp.resize(n, 0);
    graph.resize(n);
    num.resize(n);
    det.resize(n);
    p.resize(n, -1);
    for (int i = 1; i < n; ++i) {
        int u;
        cin >> u;
        --u;
        p[i] = u;
        graph[u].push_back(i);
        graph[i].push_back(u);
    }
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }
    set<pair<int, int>> S;
    S.insert(make_pair(-s[0], 0));
    int cnt = 0;
    while (!S.empty()) {
        auto t = *S.begin();
        S.erase(S.begin());
        num[t.second] = cnt++;
        for (auto elem : graph[t.second]) {
            if (elem != p[t.second]) {
                S.insert({-s[elem], elem});
            }
        }
    }
    dfs(0);
    vector<int> ind(n, 0);
    for (int i = 0; i < n; ++i) {
       ind[num[i]] = i;
    }
    for (int _ = 0; _ < q; ++_) {
        int u;
        cin >> u;
        --u;
        int pr = s[u];
        int mn = ind[u];
        int prost = ind[u];
        int from = u;
        u = p[u];
        //cout << u << endl;
        while (u != -1) {
            //cout << u << endl;
            for (auto elem : graph[u]) {
                //cout << elem << endl;
                if (elem != p[u] && elem != from) {
                    mn = min(mn, prost + (int)(lower_bound(det[elem].begin(), det[elem].end(), pr) - det[elem].begin()) - (int)det[elem].size());
                }
            }
            from = u;
            u = p[u];
        }
        cout << mn << " ";
    }
}

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