#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <map>



using namespace std;

typedef long long ll;

mt19937 gen;

int rnd(int l, int r) {
	return uniform_int_distribution<int>(l, r)(gen);
}

const int M = 998244353;

const int N = 1e6 + 7;

vector<int> g[N];

bool fl[N];
int dp[N];


int fs(int a, int b) {
	if (b == 0) return 1;
	int p = fs(a, b / 2);
	p = (p * 1ll * p) % M;
	if (b % 2 == 1) {
		p = (p * 1ll * a) % M;
	}
	return p;
}

ll dfs(int v) {
	ll res = 0;
	dp[v] = 1;

	for (int u : g[v]) {
		res += dfs(u);
		dp[v] += dp[u];
	}

	if (fl[v]) {
		res = (res + fs(2, dp[v])) % M;
		for (int u : g[v]) {
			res = (res + M + 1 - fs(2, dp[u])) % M;
		}
		res = (res + M - 1) % M;
	}

	return res;
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cout.precision(30);
	/*
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			c[i][j] = 0;
		}
	}

	for (int i = 0; i < N; ++i) {
		c[i][0] = 1;
		c[i][i] = 1;
	}

	for (int i = 1; i < N; ++i) {
		for (int j = 1; j < i; ++j){
			c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % N;
		}
	}
	*/
	int n, k;
	cin >> n >> k;

	for (int i = 0; i < k; ++i) {
		int x;
		cin >> x;
		--x;
		fl[x] = true;
	}

	for (int i = 1; i < n; ++i) {
		int pi;
		cin >> pi;

		g[--pi].push_back(i);
	}

	cout << dfs(0) << '\n';
}
