#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <random>
#include <chrono>
#include <queue>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define allv(x) (x).begin(), (x).end()
#define allv_rev(x) (x).rbegin(), (x).rend()
#define lolset(x) memset(x, 0, sizeof (x))
#define lolfill(x, v) fill(x, x + sizeof(x) / sizeof(*x), v)
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
template<typename T, typename T2>
bool smin(T &a, T2 const& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename T2>
bool smax(T &a, T2 const& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T>
using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

template<typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &i : v)
        is >> i;
    return is;
}




#ifdef DEBUG
const ll MAXN = 57, INF = 1e6;
#else
const ll MAXN = 3e5 + 10, INF = 1e9 + 1e6 * 228;
#define cerr if (0) cerr
#endif


int par[MAXN];
int par1[MAXN];
int s[MAXN];
int q_idx[MAXN];
int q_ans[MAXN];
int cnt_sub[MAXN];


struct StackMin {
    vector<int> stck, stck_min;
    void push(int v) {
        stck.push_back(v);
        if (stck_min.empty() || stck[stck_min.back()] > v)
            stck_min.push_back(sz(stck) - 1);
    }
    void pop() {
        if (stck_min.back() == sz(stck) - 1)
            stck_min.pop_back();
        stck.pop_back();
    }
    int getmin() {
        return stck[stck_min.back()];
    }
    int back() {
        return stck.back();
    }
} stck;


struct Max2 {
    int max1, max2;
    inline void add(int v) {
        if (v > max1) {
            max2 = max1;
            max1 = v;
        } else if (v > max2) {
            max2 = v;
        }
    }
    inline void setmax(int v1, int v2) {
        if (v1 == max1) {
            smax(max1, v2);
        } else {
            smax(max2, v2);
        }
        if (max2 > max1)
            swap(max1, max2);
    }
    inline int getmax_wo(int v) {
        return max1 == v ? max2 : max1;
    }
};

Max2 max_sub_child_1;


vector<int> g[MAXN];


signed one() {
    int n, qn;
    cin >> n >> qn;
    for (int i = 2; i <= n; i++) {
        cin >> par[i];
        g[par[i]].push_back(i);
        par1[i] = (par[i] == 1 ? i : par1[par[i]]);
    }
    for (int i = 1; i <= n; i++)
        cin >> s[i];
    lolfill(q_idx, -1);
    for (int i = 0; i < qn; i++) {
        int v;
        cin >> v;
        q_idx[v] = i;
    }
    priority_queue<pair<int, int>> q;
    q.push({s[1], 1});
    for (int cnt_iter = 0; !q.empty(); cnt_iter++) {
        auto [dv, v] = q.top();
        q.pop();
        if (v != 1) {
            int u = par1[v];
            cnt_sub[u]++;
            max_sub_child_1.setmax(cnt_sub[u] - 1, cnt_sub[u]);
        }
        for (int u : g[v]) {
            q.push({s[u], u});
        }
        if (q_idx[v] == -1) continue;
        q_ans[q_idx[v]] = cnt_iter;
        if (v != 1) {
            smin(q_ans[q_idx[v]], cnt_iter - max_sub_child_1.getmax_wo(cnt_sub[par1[v]]));
        }
    }
    for (int i = 0; i < qn; i++)
        cout << q_ans[i] << ' ';
    cout << '\n';
    return 0;
}



signed main() {
#ifndef DEBUG
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    signed t;
    t = 1;
    while (t--) {
        signed retcode = one();
        if (retcode) return retcode;
    }
    return 0;
}
