#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <immintrin.h>

using namespace std;
using namespace __gnu_pbds;

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2,bmi,popcnt")


// #define double long double
#define int long long
#define endl "\n"
#define ordered_set  tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

constexpr int MOD = 998244353;
constexpr int INF = 2e9;
constexpr int K = 3;
constexpr int P = 31;
constexpr double eps = 1e-9;
constexpr int MOD1 = (1ll << 61) - 1;

inline int pls(int a, int b) {
    if (a + b >= MOD1) return a + b - MOD1;
    return a + b;
}

inline int mns(int a, int b) {
    return pls(a, MOD1 - b);
}

inline int umn(int a, int b) {
    __int128 c = __int128(a) * b;
    return pls(c & MOD1, c >> 61);
}

int binpow(int n, int k, int mod) {
    if (!k) return 1;
    if (k & 1) return n * binpow(n, k ^ 1, mod) % mod;
    int c = binpow(n, k >> 1, mod);

    return c * c % mod;
}

vector<vector<int> > gr;
vector<bool> bar;
vector<vector<vector<int> > > dp;
vector<int> sz;


vector<int> fact, fact_;

int C(int n, int k) {
    return fact[n] * fact_[k] % MOD * fact_[n - k] % MOD;
}

void dfs1(int v) {
    for (int u: gr[v]) {
        dfs1(u);
        sz[v] += sz[u];
    }
    dp[v].resize(sz[v] + 1, vector<int>(3));

    if (!bar[v]) {
        dp[v][0][2] = 1;
        for (int u : gr[v]) {
            for (int ost = sz[v]; ost >= 0; ost--) {
                int pls = 0;
                for (int ostu = 0; ostu <= sz[u] && ostu <= ost; ostu++) {
                    pls += dp[v][ost - ostu][2] * dp[u][ostu][2];
                    pls %= MOD;
                }
                dp[v][ost][2] = pls % MOD;
            }
        }
        for (int ost = sz[v]; ost >= 1; ost--) {
            dp[v][ost][2] = dp[v][ost - 1][2];
            dp[v][ost][2] %= MOD;
        }
        dp[v][0][2] = 0;
        return;
    }
    dp[v][0][0] = 1;

    for (int u: gr[v]) {
        for (int ost = sz[v]; ost >= 0; ost--) {
            vector<int> pls(3);
            for (int ostu = 0; ostu <= sz[u]; ostu++) {
                if (ostu <= ost) {
                    pls[0] += dp[v][ost - ostu][0] * dp[u][ostu][2];
                    pls[1] += dp[v][ost - ostu][1] * dp[u][ostu][2];
                    pls[2] += dp[v][ost - ostu][2] * dp[u][ostu][2];
                    pls[0] %= MOD;
                    pls[1] %= MOD;
                    pls[2] %= MOD;
                }
                for (int l = 1; l <= ostu; l++) {
                    if (ost - (ostu - l) < 0) continue;
                    pls[1] += dp[v][ost - (ostu - l)][0] * dp[u][ostu][2] % MOD * C(ostu, l) % MOD;
                    pls[2] += dp[v][ost - (ostu - l)][1] * dp[u][ostu][2] % MOD * C(ostu, l) % MOD;
                    pls[2] += dp[v][ost - (ostu - l)][2] * dp[u][ostu][2] % MOD * C(ostu, l) % MOD;
                    pls[1] %= MOD;
                    pls[2] %= MOD;
                }
            }
            dp[v][ost][0] = pls[0];
            dp[v][ost][1] = pls[1];
            dp[v][ost][2] = pls[2];
            dp[v][ost][0] %= MOD;
            dp[v][ost][1] %= MOD;
            dp[v][ost][2] %= MOD;
        }
    }
    for (int ost = sz[v]; ost >= 0; ost--) {
        dp[v][ost][2] = dp[v][ost][0] + dp[v][ost][1] + dp[v][ost][2];
        if (ost) {
            dp[v][ost][2] += dp[v][ost - 1][2];
        }
        dp[v][ost][2] %= MOD;
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, k;
    cin >> n >> k;
    gr.resize(n);
    sz.resize(n, 1);
    dp.resize(n);
    bar.resize(n);
    for (int i = 0; i < k; i++) {
        int x;
        cin >> x;
        x--;
        bar[x] = true;
    }
    for (int i = 1; i < n; i++) {
        int pr;
        cin >> pr;
        pr--;
        gr[pr].push_back(i);
    }
    fact.resize(n + 1);
    fact_.resize(n + 1);
    fact[0] = 1;
    for (int i = 1; i <= n; i++) {
        fact[i] = fact[i - 1] * i % MOD;
    }
    fact_[n] = binpow(fact[n], MOD - 2, MOD);
    for (int i = n - 1; i >= 0; i--) {
        fact_[i] = fact_[i + 1] * (i + 1) % MOD;
    }
    dfs1(0);
    int sum = 0;
    for (int i = 0; i <= n; i++) {
        sum += dp[0][i][2];
        sum %= MOD;
    }
    cout << sum << endl;
}
