#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3", "Ofast", "unroll-loops", "fast-math")
#pragma GCC target("avx", "avx2")

using ll = long long;
using lll = __int128;
using dd = long double;
using para = pair <ll, ll>;
using parad = pair <dd, dd>;
const ll maxn = 1000000;
ll pp[maxn + 1];
const ll mod = 998244353;
vector <ll> g[maxn];
bool z[maxn];
ll n, k;
ll ans = 0;
ll sz[maxn];
void sizes(ll v) {
    sz[v] = 1;
    for (auto& to : g[v]) {
        sizes(to);
        sz[v] += sz[to];
    }
}
void dfs(ll v) {
    ll s = (pp[sz[v]] - 1 + mod) % mod;
    for (auto& to : g[v]) {
        dfs(to);
        s = (s - pp[sz[to]] + 1 + mod) % mod;
    }
    if (z[v]) {
        ans = s;
    }
}
void solvetask() {
    cin >> n >> k;
    pp[0] = 1;
    for (ll i = 1; i <= n; ++i) {
        pp[i] = pp[i - 1] * 2 % mod;
    }
    for (ll i = 0; i < k; ++i) {
        ll x;
        cin >> x;
        x--;
        z[x] = true;
    }
    for (ll i = 1; i < n; ++i) {
        ll x;
        cin >> x;
        x--;
        g[x].push_back(i);
    }
    sizes(0);
    if (k == 1) {
        dfs(0);
        cout << ans;
        return;
    }
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll tests = 1;
    //cin >> tests;
    while (tests--) {
        solvetask();
    }
    return 0;
}