// cf: stupid_moron
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int inf = 1e9 + 2145;
mt19937 rng(time(0));

const int mod = 998244353;
const int N = 1e6 + 21;
int n, k, x[N], p[N];
vector<int> g[N];
int sz[N];

void dfs(int v) {
	sz[v] = 1;
	for (auto &u : g[v]) {
		dfs(u);
		sz[v] += sz[u];
	}
}

int add(int a, int b) {
	int c = a + b;
	while (c >= mod) c -= mod;
	while (c < 0) c += mod;
	return c;
}

int mul(int a, int b) {
	return (a * 1ll * b) % mod;
}

int modpow(int a, int b) {
	int r = 1;
	while (b) {
		if (b & 1) r = mul(r, a);
		a = mul(a, a);
		b >>= 1;
	}
	return r;
}


void solve() {
	cin >> n >> k;
	for (int i = 1; i <= k; i++)
		cin >> x[i];
	for (int i = 2; i <= n; i++) {
		cin >> p[i];
		g[p[i]].push_back(i);
	}
	dfs(1);
	int v = x[1];
	int take = modpow(2, sz[v] - 1);
	int sum = 0;
	for (auto &u : g[v]) {
		sum = add(sum, modpow(2, sz[u]) - 1);
	}

	int notake = add(modpow(2, sz[v] - 1), -1);
	notake = add(notake, -sum);
	cout << add(take, notake) << '\n';
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int t = 1;
	// cin >> t;

	while (t--) {
		solve();
	}

	return 0;
}