#include <bits/stdc++.h>

#define f first
#define s second
#define pb push_back
#define all(x) x.begin(), x.end()

using namespace std;
typedef long long ll;

const ll mod = 998244353;

vector<int> g[1000100];

ll bpow(ll a, ll k) {
    ll ans = 1;
    while (k) {
        if (k & 1)
            ans = (ans * a) % mod;
        k >>= 1;
        a = (a * a) % mod;
    }
    return ans;
}

int sz[1000100];

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

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> a(k);
    for (auto& i : a)
        cin >> i;
    for (int i = 2, x; i <= n; ++i) {
        cin >> x;
        g[x].pb(i);
    }
    dfs(a[0]);
    ll ans = bpow(2ll, sz[a[0]] - 1);
    ll add = 1;
    ll sum = 0;
    if (g[a[0]].size() > 1)
        for (auto u : g[a[0]]) {
            add = (add * bpow(2ll, sz[u])) % mod;
            sum += sz[u];
        }
    cout << (ans + add - 1 - sum + mod) % mod << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin >> t;
    while (t--)
        solve();
    return 0;
}
