#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <sstream>
#include <cmath>
#include <chrono>
#include <random>
#include <cassert>
#define endl '\n'
#define ALL(v) v.begin(), v.end()
#define current_time chrono::steady_clock().now().time_since_epoch().count()

using namespace std;

template <typename T1, typename T2>
bool rmin(T1& x, const T2& y)
{
	if (y < x)
	{
		x = y;
		return true;
	}
	return false;
}
template <typename T1, typename T2>
bool rmax(T1& x, const T2& y)
{
	if (x < y)
	{
		x = y;
		return true;
	}
	return false;
}

constexpr uint32_t MOD = 998'244'353, MOD_phi = MOD - 1;

struct Mod_int
{
	uint32_t val;

	Mod_int& operator+=(const Mod_int& a)
	{
		if ((val += a.val) >= MOD)
		{
			val -= MOD;
		}
		return *this;
	}
	Mod_int& operator-=(const Mod_int& a)
	{
		if ((val -= a.val) & 0x80'00'00'00)
		{
			val += MOD;
		}
		return *this;
	}
	Mod_int& operator*=(const Mod_int& a)
	{
		val = int64_t(val) * a.val % MOD;
		return *this;
	}

	friend Mod_int operator+(const Mod_int& a, const Mod_int& b)
	{
		return Mod_int(a) += b;
	}
	friend Mod_int operator-(const Mod_int& a, const Mod_int& b)
	{
		return Mod_int(a) -= b;
	}
	friend Mod_int operator*(const Mod_int& a, const Mod_int& b)
	{
		return Mod_int(a) *= b;
	}

	Mod_int pow(uint64_t pow_val) const
	{
		Mod_int ans{ 1 }, mlt{ val };
		while (pow_val)
		{
			if (pow_val & 1)
			{
				ans *= mlt;
			}
			mlt *= mlt;
			pow_val >>= 1;
		}
		return ans;
	}

	Mod_int& operator/=(const Mod_int& a)
	{
		return *this *= a.pow(MOD_phi - 1);
	}

	friend Mod_int operator/(const Mod_int& a, const Mod_int& b)
	{
		return Mod_int(a) /= b;
	}
};

constexpr int32_t INF = 2'000'000'001;
constexpr int64_t INFl = 2'000'000'000'000'000'001;
constexpr uint32_t MAXN = 300'000;

void solve();

signed main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif // _DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int t = 1;
	//cin >> t;
	for (int i = 0; i < t; i++)
	{
		solve();
		cout << endl;
	}

	return 0;
}

vector<int> g[MAXN];
int par[MAXN], comp[MAXN], ind_comp[MAXN], dsu[MAXN];
int get_par(int v)
{
	if (dsu[v] < 0)
	{
		return v;
	}
	return dsu[v] = get_par(dsu[v]);
}
void unite(int u, int v)
{
	u = get_par(u);
	v = get_par(v);
	assert(u != v);
	if (dsu[v] < dsu[u])
	{
		swap(u, v);
	}
	dsu[u] += dsu[v];
	dsu[v] = u;
	return;
}

int dfs_key(int v, int key)
{
	if (comp[v] < key)
	{
		return 0;
	}
	int ans = 1;
	for (int i = 0; i < g[v].size(); i++)
	{
		int nxt = g[v][i];
		ans += dfs_key(nxt, key);
	}
	return ans;
}
pair<int, int> dfs(int v, int ban_ch, int key)
{
	int mx = 0, sum = 0;
	for (int i = 0; i < g[v].size(); i++)
	{
		int nxt = g[v][i];
		if (nxt != ban_ch)
		{
			int n_val = dfs_key(nxt, key);
			rmax(mx, n_val);
			sum += n_val;
		}
	}
	return { sum ,mx };
}

void solve()
{
	int n, q;
	cin >> n >> q;
	for (int i = 0; i < n - 1; i++)
	{
		cin >> par[i + 1];
		--par[i + 1];
		g[par[i + 1]].push_back(i + 1);
	}
	for (int i = 0; i < n; i++)
	{
		cin >> comp[i];
		ind_comp[comp[i]] = i;
	}

	for (int i = 0; i < q; i++)
	{
		int v;
		cin >> v;
		--v;
		int sum = 0, mx = 0, key = comp[v];
		while (v != 0)
		{
			pair<int, int> n_val = dfs(par[v], v, key);
			sum += n_val.first;
			rmax(mx, n_val.second);
			v = par[v];
			++sum;
		}
		cout << sum - mx << ' ';
	}

	return;
}