#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define int int64_t
#define vi vector<int>
#define vvi vector<vi>
#define vvvi vector<vvi>
#define pii pair<int, int>
#define vpi vector<pii>
#define vb vector<bool>
#define umap unordered_map
using namespace std;
const int mod = 998244353;
//using namespace __gnu_pbds;
mt19937 rng(333);
//template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//template<class T> using omset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
int powmod(int b, int p) {
	int s=1;
	while (p) {
		if (p&1) s = (s*b)%mod;
		b = (b*b)%mod;
		p >>= 1;
	}
	return s;
}
int dfs(vvi& D, vb& good, int cur, vi& out, int k) {
	//cout << "on " << cur+1 << endl;
	if (!good[cur]) {
		int c=1;
		if (D[cur].size() == 0) {
			out.assign(0, 0);
			return 1;
		}
		if (D[cur].size() == 1) {
			vi temp(0, 0);
			c += dfs(D, good, D[cur][0], temp, k);
			swap(out, temp);
			return c;
		}
		vi temp(0, 0);
		out.assign(k, 1);
		for (int i=0; i<D[cur].size(); ++i) {
			c += dfs(D, good, D[cur][i], temp, k);
			if (temp.size() > 0) {
				for (int j=0; j<k; ++j) out[j] = (out[j]*temp[j])%mod;
			}
		}
		return c;
	}
	k++;
	if (D[cur].size() == 0) {
		vi temp(k, 0);
		for (int i=0; i<k; ++i) temp[i] = 1;
		swap(temp, out);
		return 0;
	}
	vvi temp(D[cur].size(), vi(0, 0));
	int x;
	vi p(k, 1);
	for (int i=0; i<D[cur].size(); ++i) {
		x = dfs(D, good, D[cur][i], temp[i], k);
		//cout << "got x " << x << endl;
		if (temp[i].size() == 0) {temp[i].assign(k, 1);}
		for (int j=0; j<k; ++j) {
			temp[i][j] = (temp[i][j]*powmod(j+1, x))%mod;
			//cout << temp[i][j] << ' ';
			p[j] = (p[j]*temp[i][j])%mod;
		}
		//cout << endl;
	}
	out.assign(k-1, 0);
	//for (int i=0; i<k-1; ++i) out[i] = (p[i]*(i+1))%mod;
	for (int i=0; i<k-1; ++i) {
		x = (p[i+1]-p[i]+mod)%mod;
		//cout << "first x " << x << endl;
		for (int j=0; j<temp.size(); ++j) {
			//cout << "sub " << (((((((temp[j][i+1]+mod-temp[j][i])%mod)*p[i])%mod)*powmod(temp[j][i], mod-2))%mod))%mod << endl;
			x = (x+mod-((((((temp[j][i+1]+mod-temp[j][i])%mod)*p[i])%mod)*powmod(temp[j][i], mod-2))%mod))%mod;
		}
		out[i] = (out[i]+((x*(i+1))%mod))%mod;
		//cout << "adding " << x << endl;
	}
	for (int i=0; i<k-1; ++i) out[i] = (out[i]+p[i+1])%mod;
	//cout << "res " << cur+1 << ": "; for (int e : out) cout << e << ' '; cout << endl;
	return 0;
}
void solve() {
	int n, k; cin >> n >> k;
	vb good(n, false);
	int x;
	for (int i=0; i<k; ++i) {
		cin >> x; good[x-1] = true;
	}
	vvi D(n, vi());
	for (int i=1; i<n; ++i) {
		cin >> x;
		D[x-1].push_back(i);
	}
	vi out(0, 0);
	dfs(D, good, 0, out, 1);
	cout << out[0] << '\n';
}
signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int t=1; //cin >> t;
	while (t--) solve();
	return 0;
}
