#include <bits/stdc++.h>

using namespace std;

#define int long long
#define double long double

int inf = (int)1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 100;
// int inf = (int)1000 * 1000 * 1000 + 100;

/*
#pragma optimize("O3")
#pragma optimize("avx,avx2,bmi,bmi2")
*/

mt19937_64 rnd(228);

void print(vector <int> a) {
    for (int i = 0; i < a.size(); i ++) {
        cout << a[i] << " ";
    }
    cout << '\n';
}

int mod = 998244353;

int umn(int a, int b) {
    return (a * b) % mod;
}

int umn(int a, int b, int c) {
    return umn(a, umn(b, c));
}

int umn(int a, int b, int c, int d) {
    return umn(a, umn(b, c, d));
}

int umn(int a, int b, int c, int d, int e) {
    return umn(a, umn(b, c, d, e));
}

int bin_pow(int a, int x) {
    if (x == 0) {
        return 1;
    }
    if (x % 2 == 0) {
        return bin_pow(umn(a, a), x / 2);
    }
    return umn(a, bin_pow(a, x - 1));
}

void dfs(int v, vector <vector <int>> &g, vector <int> &sz) {
    sz[v] = 1;
    for (auto u : g[v]) {
        dfs(u, g, sz);
        sz[v] += sz[u];
    }
}

int norm(int x) {
    x %= mod;
    x += mod;
    x %= mod;
    return x;
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector <int> x(k);
    for (int i = 0; i < k; i ++) {
        cin >> x[i];
        x[i] --;
    }

    vector <int> p(n);
    for (int i = 0; i < n; i ++) {
        cin >> p[i + 1];
        p[i + 1] --;
    }

    vector <vector <int>> g(n);
    for (int i = 1; i < n; i ++) {
        g[p[i]].push_back(i);
    }

    vector <int> sz(n);
    dfs(0, g, sz);

    int f1 = sz[x[0]];
    int f2 = n - f1;

    int ans = bin_pow(2, f1) - 1;
    ans = norm(ans);

    cout << ans << '\n';
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

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