#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using i128 = __int128_t;

const ll inf = 1e18 + 1e16;
const ll inf_t = 1e9 + 7;
const ll mod = 998244353;

#define int ll

const int MAXN = 1000000;
vector <int> g[MAXN];
int sz[MAXN];

int ans[MAXN];

int bin_pow(int a, int b) {
    if (b == 0) return 1;
    if (b & 1) return bin_pow(a, b - 1) * a % mod;
    int temp = bin_pow(a, b / 2);
    return temp * temp % mod;
}

void dfs(int v) {
    sz[v] = 1;
    int cur = 1;
    for (int u : g[v]) {
        dfs(u);
        sz[v] += sz[u];

        cur = cur * bin_pow(2, sz[u]) % mod;
    }
    cur = cur * 2 % mod;
    cur = (cur - sz[v] + mod) % mod;

    ans[v] = cur;
}

void solve() {
    int n, k;
    cin >> n >> k;

    vector <int> x(k);
    for (int i = 0; i < k; ++i) {
        cin >> x[i];
    }

    for (int i = 1; i < n; ++i) {
        int p;
        cin >> p;

        g[p - 1].push_back(i);
    }

    dfs(0);

    cout << ans[x[0] - 1];    
}

signed main() {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}
