#include <bits/stdc++.h>
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi2,popcnt,lzcnt")
using ll = long long;
using ld = long double;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
// template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//s.erase(s.find_by_order(s.order_of_key(5)));

const int MOD = 998244353;

int add(int a, int b) {
    if (a + b >= MOD) return a + b - MOD;
    return a + b;
}

int sub(int a, int b) {
    if (a < b) return a - b + MOD;
    return a - b;
}

int mul(int a, int b) {
    return a * 1ll * b % MOD;
}

int binPow(int a, int n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        return binPow(mul(a, a), n / 2);
    } else {
        return mul(a, binPow(a, n - 1));
    }
}

vector<vector<int>> G;
vector<vector<vector<int>>> dp;
int n;
/*
void dfs(int v) {
    for (auto u : G[v]) {
        dfs(u);
        for (int k = 0; k < n; k++) {
            for (int c = 0; c < n; c++) {
                for (int e = 0; e < n; e++) {
                    dp[v][]
                }
            }
        }
    }
}*/

vector<int> sz;
vector<int> used;

int dfs(int v) {
    used[v] = 1;
    sz[v] = 1;
    for (auto u : G[v]) {
        sz[v] += dfs(u);
    }
    return sz[v];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //cout << fixed << setprecision(17);
    int n, k;
    cin >> n >> k;
    vector<int> x(k);
    G.resize(n);
    used.resize(n);
    sz.resize(n);
    for (int i = 0; i < k; i++) {
        cin >> x[i];
        x[i]--;
    }
    int p;
    for (int i = 1; i < n; i++) {
        cin >> p;
        p--;
        G[p].push_back(i);
    }
    dfs(0);
    ll ans = add(binPow(2, sz[x[0]] - 1), binPow(2, sz[x[0]] - 1));
    for (auto u : G[x[0]]) {
        ans = sub(ans, sub(binPow(2, sz[u]), 1));
    }
    ans = sub(ans, 1);
    cout << ans;
    return 0;
}
//1 3 1 2 2 1 1 2 2 2