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

#define int int_fast64_t
#define ull unsigned long long
#define all(x) x.begin(), x.end()
mt19937 rng(127);

constexpr int MAXN = 1e6 + 1, INF = 2e9, MOD = 998244353, k1 = 31;
// constexpr int interesno_zabanyat_li_menya_prosto_za_stroku_v_reshenii_MOD = 435397531;

int res = 0;
int p[MAXN], x[MAXN];
vector<int> g[MAXN];
int tin[MAXN], tout[MAXN], timer = 0, sz[MAXN];

void dfs(int s) {
    tin[s] = timer++;
    sz[s] = 1;
    for (int i: g[s]) {
        dfs(i);
        sz[s] += sz[i];
    }
    tout[s] = timer++;
}

bool anc(int u, int v) {
    return tin[u] <= tin[v] && tout[u] >= tout[v];
}


int bp(int n, int k) {
    int res = 1;
    while (k) {
        if (k & 1) {
            res *= n;
            res %= MOD;
        }
        n *= n;
        n %= MOD;
        k >>= 1;
    }
    return res;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= k; i++) {
        cin >> x[i];
    }
    for (int i = 2; i <= n; i++) {
        int pr;
        cin >> pr;
        p[i] = pr;
        g[pr].push_back(i);
    }
    res = 0;
    dfs(1);
    int s = x[0];
    res = bp(2, sz[s]);
    res--; // vse
    for (int i : g[x[0]]) {
        res -= (bp(2, sz[i]) - 1);
    }
    res %= MOD;
    res += MOD;
    res %= MOD;
    cout << res << endl;
    return 0;
}
