#include <experimental/random>
#include <bits/stdc++.h>

using namespace std;
//experimental::randint(1, 10);
#define ll long long

ll MOD = 998244353;
ll INF = 1e18;
vector<vector<ll> > g;
vector<ll> up;
vector<ll> col;
ll step(ll v,ll ind) {
    if (ind == 0) {
        return 1;
    }
    if (ind % 2 == 0) {
        ll x = step(v, ind / 2);
        return (x * x) % MOD;
    }
    return (step(v, ind - 1) * v) % MOD;
}

void dfs(ll v) {
    col[v] = 1;
    for (auto to: g[v]) {
        up[to] = up[v] + 1;
        dfs(to);
        col[v] += col[to];
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n, k;
    cin >> n >> k;
    g.assign(n, {});
    up.assign(n, {});
    col.assign(n, {});
    vector<ll> x(k);
    vector<ll> p(n);
    for (ll i = 0; i < k; i++) {
        cin >> x[i];
        x[i]--;
    }
    for (ll i = 1; i < n; i++) {
        cin >> p[i];
        p[i]--;
        g[p[i]].push_back(i);
    }
    ll v = x[0];
    dfs(v);
    ll ans = 0;
    ll cnt = 1;
    vector<ll> pref(n);
    ll ind = 0;
    for (auto to: g[v]) {
        cnt *= step(2, col[to]);
        cnt %= MOD;
        pref[ind] = cnt;
        ind++;
    }
    ans = cnt;
    ind--;
    ind--;
    for (ll i = (ll) g[v].size() - 1; i >= 1; i--) {
        ans += ((pref[ind] - 1) * (step(2, col[g[v][i]]) - 1)) % MOD;
        ans%=MOD;
        ind--;
    }
    cout << ans;
}
