#include <bits/stdc++.h>

using namespace std;

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define int ll

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

const int inf = 2e9, INF = 1e18;
const int MAXN = 500 + 52, mod = 998244353;
int dp[MAXN][MAXN];
vector<int> g[MAXN];
int f[MAXN];
int p[MAXN];
bool nd[MAXN];
int sz[MAXN];

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

int sum(int a, int b) {
    return (a + b) % mod;
    int s = a + b;
    if (s >= mod) return s - mod;
    return s;
}

void add(vector<int> &dp, vector<int> &dp0, int x, int y) {
    for (int i = dp.size() - 1; i >= x; i--) {
        dp[i] = sum(dp[i], mul(dp0[i - x], y));
    }
}

int c(int n, int k) {
    return mul(f[n], mul(p[k], p[n - k]));
}

void dfs(int v) {
    sz[v] = 1;
    for (auto &u: g[v]) {
        dfs(u);
        sz[v] += sz[u];
    }
    vector<int> dp1(sz[v] + 1);
    vector<vector<int> > dp2(3, vector<int>(sz[v] + 1));
    dp1[0] = 1;
    dp2[0][0] = 1;
    for (auto &u: g[v]) {
        auto dp0 = dp1;
        fill(all(dp1), 0);
        for (int cnt = 0; cnt <= sz[u]; cnt++) {
            add(dp1, dp0, cnt, dp[u][cnt]);
        }
        // dp0.swap(dp1);
    }
    for (auto &u: g[v]) {
        auto dp0 = dp2;
        for (int cnt = 1; cnt <= sz[u]; cnt++) {
            for (int cnt1 = 0; cnt1 + cnt <= sz[u]; cnt1++) {
                add(dp2[2], dp0[1], cnt, mul(dp[u][cnt1], c(sz[u] - cnt1, cnt)));
                add(dp2[2], dp0[2], cnt, mul(dp[u][cnt1], c(sz[u] - cnt1, cnt)));
                add(dp2[1], dp0[0], cnt, mul(dp[u][cnt1], c(sz[u] - cnt1, cnt)));
            }
        }
        // dp0.swap(dp2);
    }
    if (nd[v]) {
        for (int cnt = 0; cnt <= sz[v]; cnt++) {
            for (int cnt1 = 0; cnt1 <= cnt; cnt1++) {
                if (cnt1 < cnt)
                    dp[v][cnt] = sum(dp[v][cnt], mul(dp1[cnt1], c(sz[v] - 1 - cnt1, cnt - cnt1 - 1)));
            }
            dp[v][cnt] = sum(dp[v][cnt], dp2[2][cnt]);
        }
    } else {
        for (int i = 0; i <= sz[v]; i++) dp[v][i] = dp1[i];
    }
}

int bin_pow(int a, int b) {
    int ans = 1;
    while (b) {
        if (b % 2) ans = ans * a % mod;
        b /= 2;
        a = a * a % mod;
    }
    return ans;
}

void solve() {
    int n, k;
    cin >> n >> k;
    f[0] = 1;
    for (int i = 1; i <= n; i++) f[i] = mul(f[i - 1], i);
    p[n] = bin_pow(f[n], mod - 2);
    for (int i = n - 1; i >= 0; i--) p[i] = mul(p[i + 1], i + 1);
    while (k--) {
        int x;
        cin >> x;
        nd[x] = true;
    }
    for (int i = 2; i <= n; i++) {
        int p;
        cin >> p;
        g[p].push_back(i);
    }
    dfs(1);
    int ans = 0;
    for (int i = 0; i <= sz[1]; i++) ans = sum(ans, dp[1][i]);
#ifdef LOCAL
    for (int i = 0; i <= sz[1]; i++) cout << dp[1][i] << " ";
    cout << "\n";
#endif

    cout << ans;
}

int32_t main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int tt = 1;
    // cin >> tt;
    while (tt--) {
        solve();
    }
}
