#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <ctime>
#include <climits>
#include <iomanip>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <string>
#include <queue>
#include <random>

#define int long long

#pragma GCC optimize("03,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

using ll = long long;
using ld = long double;
using namespace std;

const ll INF = 1e18;


void solve() {
	int n, q;
	cin >> n >> q;
	vector<int> p(n);
	vector<int> s(n);
	for (int i = 1; i < n; i++) {
		cin >> p[i];
		p[i]--;
	}
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	vector<int> cop = p;
	while (q--) {
		int v;
		cin >> v;
		v--;
		int mn = INF;
		for (int del = 0; del < n; del++) {
			vector<int> used(n);
			if (del == v) continue;
			int root = 0;
			int cnt = 0;
			int prev = s[del];
			s[del] = 0;
			while (root != v) {
				int mx = -INF;
				int u = 0;
				for (int i = 0; i < n; i++) {
					if (i == root || used[i]) continue;
					if (p[i] == root) {
						if (s[i] > mx) {
							mx = s[i];
							u = i;
						}
					}
				}
				for (int i = 0; i < n; i++) {
					if (p[i] == root || used[i]) {
						p[i] = u;
					}
				}
				used[root] = 1;
				root = u;
				cnt++;
			}
			p = cop;
			s[del] = prev;
			mn = min(mn, cnt);
		}
		cout << mn << " ";
	}
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}