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

#define int long long
const int MOD = 998244353, maxn = 1e6, inf = 1e9 + 7;
mt19937 rnd(55);

int tme[maxn], a[maxn], ans[maxn];
vector<int> g[maxn];
bool usd[maxn];
int n, k;

int binpow(int x, int n) {
    if (n == 0) return 1;
    int res = binpow(x, n / 2);
    res = res * res % MOD;
    if (n & 1) res = res * x % MOD;
    return res;
}

void dfs(int v) {
    sz[v] = 1;
    for (auto u : g[v]) {
        dfs(u);
        sz[v] += sz[u];
    }
    if (usd[u]) {
        int ans = binpow(2, sz[v]);
        for (auto u : g[v]) {
            ans = (ans - binpow(2, sz[u]) + MOD) % MOD;
        }
        cout << (ans + g[v].size() - 1) % MOD << "\n";
        exit(0);
    }
}

void solve() {
    cin >> n >> k;
    for (int i = 0; i < k; i++) {
        int x;
        cin >> x;
        usd[x] = 1;
    }
    for (int i = 1; i < n; i++) {
        int x;
        cin >> x;
        g[i - 1].push_back(x - 1);
    }
    dfs(0);
    return;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tests = 1;
    while (tests--) {
        solve();
    }
}
