#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
const int inf = 0x3f3f3f3f;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(x) 67
#endif
const ll mod = 998'244'353;

const int maxn = 1'000'010;
vector<int> g[maxn];
int pr[maxn];
int h[maxn];
int sz[maxn];
ll step2[maxn];
void dfs(int v) {
    sz[v] = 1;
    for (auto to : g[v]) {
        dfs(to);
        sz[v] += sz[to];
    }
}

void solve() {
    int n, k; cin >> n >> k;
    vector<int> x(k + 1);
    assert(k == 1);
    for (int i = 1; i <= k; ++i) {
        cin >> x[i];
        x[i]--;
    }
    for (int i = 1; i < n; ++i) {
        int p; cin >> p;
        p--;
        g[p].push_back(i);
        pr[i] = p;
    }
    step2[0] = 1;
    for (int i = 1; i <= n; ++i) {
        step2[i] = (step2[i - 1] * 2) % mod;
    }
    int v = x[1];
    dfs(v);
    ll ans = (step2[sz[v]] - 1 + mod) % mod;
    for (auto to : g[v]) {
        ans = (ans - step2[sz[to]] + 1 + mod) % mod;
    }
    cout << ans;
}

signed main() {
#ifndef LOCAL
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif
    int tt = 1;
    // cin >> tt;
    while (tt--) {
        solve();
        if (tt) {
            cout << '\n';
        }
    }
}