// semenInRussia 2025
#include <cstdint>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

const int N = 3e5 + 10;
int answ[N];
vector<int> g[N];

int tin[N], s[N];

template <typename T> using min_heap = priority_queue<T, vector<T>, greater<T>>;

void solve(int j) {
  int old = s[j];
  s[j] = 0;

  priority_queue<pair<int, int>> q;
  q.push({s[0], 0});

  int ti = 0;
  while (!q.empty()) {
    auto [dx, x] = q.top();
    q.pop();
    answ[x] = min(answ[x], ti++);
    for (int y : g[x]) {
      q.push({s[y], y});
    }
  }

  s[j] = old;
}

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

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

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

  solve(0);
  for (int x : g[0]) {
    solve(x);
  }

  while (q--) {
    int v;
    cin >> v;
    --v;
    cout << answ[v] << "\n";
  }
}