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

void Solve();

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ll tt = 1;
    // cin >> tt;
    while (tt--) {
        Solve();
    }
    return 0;
}

# define ff first
# define ss second

const ll mod = 998244353;

ll mult(ll a, ll b) {
    return a * b % mod;
}

ll add(ll a, ll b) {
    return (a + b) % mod;
}

ll mins(ll a, ll b) {
    return (a - b + mod) % mod;
}

ll binpow(ll a, ll p) {
    ll ans = 1;
    while (p) {
        if (p & 1) ans = mult(ans, a);
        a = mult(a, a);
        p /= 2;
    }
    return ans;
}

void Solve() {
    ll n, k;
    cin >> n >> k;
    vector<ll> a(k);
    for (auto &x : a) cin >> x;
    vector<vector<ll>> g(n);
    for (ll i = 1; i < n; ++i) {
        ll v;
        cin >> v;
        v--;
        g[v].push_back(i);
    }
    assert(k == 1);
    vector<ll> siz(n);
    auto dfs = [&](ll v, auto &&dfs) -> void {
        siz[v] = 1;
        for (auto &to : g[v]) {
            dfs(to, dfs);
            siz[v] += siz[to];
        }
        return;
    };
    dfs(0, dfs);
    ll vv = a[0] - 1;
    ll ans = binpow(2, siz[vv]) - 1;
    for (auto &to : g[vv]) {
        ans = mins(ans, mult(binpow(2, (siz[to])) - 1, g[vv].size() - 1));
    }
    cout << ans << '\n';
    return;
}