#include <iostream>
#include <vector>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#define int long long
#define ld long double

using namespace std;

vector<int> solve(vector<int> p, vector<int> s, vector<vector<int>> graph) {
	set<pair<int, int>> cur;
	for (int x : graph[0]) {
		cur.insert({ -s[x], x });
	}
	int cv = 0;
	int tm = 0;
	int n = graph.size();
	vector<int> tms(n);
	while (!cur.empty()) {
		auto p = *cur.begin();
		cur.erase(cur.begin());
		cv = p.second;
		tms[cv] = ++tm;
		for (int x : graph[cv]) {
			cur.insert({ -s[x], x });
		}
	}
	return tms;
}
void get_solve() {
	vector<vector<int>> graph;
	vector<int> p;
	vector<int> s;
	int n, q;
	cin >> n >> q;
	graph.resize(n);
	p.resize(n);
	s.resize(n);
	vector<int> qs(q);
	for (int i = 1; i < n; i++) {
		cin >> p[i];
		p[i]--;
		graph[p[i]].push_back(i);
	}
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	for (int i = 0; i < q; i++) {
		cin >> qs[i];
		qs[i]--;
	}
	vector<vector<int>> alltms(n, vector<int> (n));
	int ws;
	for (int i = 0; i < n; i++) {
		ws = s[i];
		s[i] = 0;
		alltms[i] = solve(p, s, graph);
		s[i] = ws;
	}
	for (int v : qs) {
		int ans = 1e10;
		for (int i = 0; i < n; i++) {
			ans = min(ans, alltms[i][v]);
		}
		cout << ans << '\n';
	}
}
signed main() {
	int tt = 1;// cin >> tt;
	while (tt--)
		get_solve();
}
/*
7 1
1
2
3
1
5
6
0 1 3 5
2 4 6
7
*/
