#include <bits/stdc++.h>

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2")

//#define int long long

using ll = long long;
using namespace std;

void solve() {
    int n, q, v = -1, cnt = 0;
    cin >> n >> q;
    vector<int> p(n), s(n);
    for (int i = 1; i < n; i++) {
        cin >> p[i];
        p[i]--;
        if (p[i] == 0) {
            cnt++;
        }
        if (p[i] == 0 && i != 1) {
            v = i;
        }
    }
    while (cnt > 2) {

    }
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    for (int i = 0; i < q; i++) {
        int u;
        cin >> u;
        u--;
        if (u < v || v == -1) {
            cout << u << "\n";
        } else {
            cout << u - v + 1 << "\n";
        }
    }
}

signed main() {
    int t = 1;
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
//    cin >> t;
#else
    ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
#endif
//    cin >> t;
    while (t--) {
        solve();
    }
}
