#include <bits/stdc++.h>
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz size
#define pb push_back
#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int A = 1e6 + 5;
const int MOD = 998244353;


ll n, q, i, x, mx, s[A], s1[A], fl[A], ans = 1;
vector<vector<int>> way(A);

int binpow(int x, int k) {
    int ans = 1;
    while (k) {
        if (k % 2) ans = (ans * x) % MOD;
        x = (x * x) % MOD;
        k /= 2;
    }
    return ans;
}

int sum(int a, int b) {
    return (a % MOD + b % MOD + MOD) % MOD;
}

void dfs(int v, int ln) {
    if (fl[v] == 1) ln++;
    s[v] = 1;
//    ans = (ans * (ln)) % MOD;
    for (auto to : way[v]) {
        dfs(to, ln);
        s[v] += s[to];
    }
//    ans = sum(ans, -binpow(2, ln - 1) + 1);
    if (fl[v] == 1) {
        int f = 1;
        for (auto to : way[v]) {
            f = f * binpow(2, s[to]);
        }
        f = sum(f, 0);
        ans = sum(f, ans);
    }
}

int32_t main() {
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif // LOCAL

    cin >> n >> q;
    for (i = 1; i <= q; i++) cin >> x, fl[x] = 1;
    for (i = 2; i <= n; i++) {
        cin >> x;
        way[x].pb(i);
    }
    dfs(1, 0);
    cout << ans << endl;
    return 0;
}
