#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <fstream>
#include <unordered_map>
#include <algorithm>
#include <queue>
using namespace std;

using ll = long long;

const int maxn = 3e5;
const int inf = 1e9 + 239;
vector<vector<int>> g(maxn, vector<int>(0));

vector<int> answer(maxn, inf);

void dijkstra(int n, int v, vector<int>& s) {
  int save = s[v];
  s[v] = 0;
  priority_queue<pair<int, int>> q;
  q.push({ s[0], 0 });
  int cur = -1;
  while (!q.empty()) {
    cur++;
    int u = q.top().second;
    q.pop();
    answer[u] = min(answer[u], cur);
    for (int w : g[u]) {
      q.push({s[w], w});
    }
  }
  s[v] = save;
}



void solve() {
  int n, qq;
  cin >> n >> qq;
  vector<int> s(n);
  vector<int> p(n);
  for (int i = 1; i < n; i++) {
    cin >> p[i];
    p[i]--;
    g[p[i]].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  /*
  for (int v = 0; v < n; v++) {
    dijkstra(n, v, s);
  }*/
  vector<int> ord(n);
  priority_queue<pair<int, int>> q;
  q.push({ s[0], 0 });
  int i = 0;
  while (!q.empty()) {
    int u = q.top().second;
    ord[i] = u;
    q.pop();
    for (int w : g[u]) {
      q.push({ s[w], w });
    }
    i++;
  }
  vector<int> pos(n, 0);
  for (int i = 0; i < n; i++) {
    pos[ord[i]] = i;
  }
  while (qq--) {
    int v;
    cin >> v;
    v--;
    vector<int> cnt(n, 1);
    int bad = p[v];
    int ans = pos[v];
    for (int i = pos[v] - 1; i >= 0; i--) {
      int u = ord[i];
      if (u != bad) {
        ans = min(ans, pos[v] - cnt[u]);
        cnt[p[u]] += cnt[u];
      } else {
        bad = p[bad];
      }
    }
    cout << ans << '\n';
  }
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
