#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
using namespace std;
using ll = long long;
void solve() {
	ll n, q;
	cin >> n >> q;
	vector<ll> an(n);
	bool fl = 1;
	for (int i = 1; i < n; i++) {
		cin >> an[i];
		an[i]--;
		if (an[i] != i - 1) {
			fl = 0;
		}
	}
	
	vector<ll> s(n);
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		if (i == 0) {
			s[i] = -1;
		}
	}
	vector<ll> tmp = s;
	sort(tmp.begin(), tmp.end());
	while (q--) {
		ll v;
		cin >> v;
		v--;
		if (fl) {
			cout << v << endl;
			exit(1);
		}
		else {
			if (v == 0) {
				cout << 0 << endl;
				continue;
			}
			if (s[v] == *--tmp.end()) {
				cout << 1 << endl;
				continue;
			}
			auto p = lower_bound(tmp.begin(), tmp.end(), s[v]);
			ll ind = p - tmp.begin();
			cout << tmp.size() - ind - 1 << endl;
		}
	}
}
int main()
{
	solve();
}

