#include <iostream>
//#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
//#include <map>
//#include <cmath>

using namespace std;

typedef long long ll;
//typedef long double ld;

#define int long long
#define ff first
#define ss second
#define endl '\n'


const int INF = 1e18 + 123;

int ps[300000], h[300000];
vector<int> st[300000], g[300000];
vector<int> stid;
int w[300000];

void dfs(int v, int p) {
    if (ps[v] == -1 && v != 0) {
        ps[v] = v;
        stid.push_back(v);
        st[v].push_back(-w[v]);
    }
    for (auto u: g[v]) {
        if (u != p) {
            ps[u] = ps[v];
            h[u] = h[v] + 1;
            if (ps[u] != -1) st[ps[u]].push_back(max(st[ps[u]].back(), -w[u]));
            dfs(u, v);
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, q;
    cin >> n >> q;
    for (int i = 1; i < n; ++i) {
        int p;
        cin >> p;
        p--;
        g[p].push_back(i);
        g[i].push_back(p);
    }

    for (int i = 0; i < n; ++i) {
        ps[i] = -1;
    }


    for (int i = 0; i < n; ++i) {
        cin >> w[i];
    }

    dfs(0, -1);

    for (int i = 0; i < q; ++i) {
        int x;
        cin >> x;
        x--;
        if (x == 0) {
            cout << 0 << endl;
            continue;
        }

        if (h[x] == 0 || st[ps[x]].size() <= h[x] - 1) {
            cout << -1 << endl;
            continue;
        }

        int mn = st[ps[x]][h[x] - 1];

        int mxt = 0, s = 0;
        for (auto y: stid) {
            if (ps[x] == y) continue;
            int ttt = lower_bound(st[y].begin(), st[y].end(), mn) - st[y].begin();
            mxt = max(mxt, ttt);
            s += ttt;

        }

        cout << h[x] + s - mxt << endl;
    }
}
