#include <bits/stdc++.h>
using  namespace std;
#define all(x) x.begin(), x.end()
using ll = long long;
using sll = __int128;
using ld = long double;
const int mod = 998244353;
const int maxn = 1e6 + 10;
vector<int> g[maxn];
int sz[maxn];
void dfs(int v) {
    sz[v] = 1;
    for (int to:g[v]) {
        dfs(to);
        sz[v] += sz[to];
    }
}
int bpow(int x, int y) {
    ll res = 1;
    while (y > 0) {
        if (y & 1) res = res * x % mod;
        x = (ll) x * x % mod;
        y >>= 1;
    }
    return res;
}
void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> x(k + 1);
    for (int i = 1; i <= k; ++i) cin >> x[i];
    vector<int> p(n + 1);
    for (int i = 2; i <= n; ++i) {
        cin >> p[i];
        g[p[i]].push_back(i);
    }
    dfs(x[1]);
    ll ans = 0;
    int rt = x[1];
    ans += bpow(2, sz[rt]);
    for (int to:g[rt]) {
        ans = (ans + mod - bpow(2, sz[to]) + 1) % mod;
    }
    ans = (ans + mod - 1) % mod;
    cout << ans;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}