#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair

using namespace std;
using ll = long long;
using vi = vector<int>;
using pi = pair<int, int>;
using ld = long double;

const int MOD = 998244353;

int sum(int x, int y) {
    if (x + y >= MOD) return x + y - MOD;
    return x + y;
} 

int mul(int x, int y) {
    return 1ll * x * y % MOD;
}

void summ(int &x, int y) {
    x = sum(x, y);
}

int timer = 0;

vector<vi> g;
vi par, x, good, sz, tin, tout;

vector<vi> dp;

void dfsInit(int v, int p) {
    tin[v] = timer++;
    sz[v] = 1;

    for (int u : g[v]) {
        if (u == p) continue;
        dfsInit(u, v);
        sz[v] += sz[u];
    }

    tout[v] = timer - 1;
}

void dfsDp(int v, int p) {
    int len = g[v].size();

    vector<vector<vi>> ruck(len + 1, vector<vi>(2, vi(sz[v] + 1)));

    for (int u : g[v]) {
        dfsDp(u, v);
    }

    ruck[0][0][0] = 1;

    int sm = 0;

    for (int i = 0; i < len; ++i) {
        int u = g[v][i];

        for (int cr = 0; cr <= sm; ++cr) {
            for (int j = 0; j <= sz[u]; ++j) {
                summ(ruck[i + 1][0][cr + j], mul(ruck[i][0][cr], dp[u][j]));
                summ(ruck[i + 1][1][cr + j], mul(ruck[i][1][cr], dp[u][j]));
                if ((j != sz[u])) {
                    summ(ruck[i + 1][1][cr + j + 1], mul(mul(ruck[i][0][cr], sz[u] - j), dp[u][j]));
                }
            }
        }

        sm += sz[u];
    }

    if (v == 1) {
        cout << "RCUK" << endl;
        for (int i = 0; i < sz[v]; ++i) {
            cout << "i " << i << ' ' << ruck[len][0][i] << ' ' << ruck[len][1][i] << endl;
        }

        // return;
    }

    if (good[v]) {
        for (int res = 0; res < sz[v]; ++res) {
            dp[v][res + 1] = sum(dp[v][res + 1], ruck[len][0][res]);
            dp[v][res + 1] = sum(dp[v][res + 1], ruck[len][1][res]);

            // if (v == 1 && res + 1 == 3) cout << "d q " << ruck[len][0][res] << ' ' << ruck[len][1][res] << endl;
            // dp[v][res] = sum(dp[v][res], ruck[len][1][res]);
            // if (v == 1 && res == 3) cout << "t " <<  ruck[len][1][res] << endl;
        }
    } else {
        dp[v] = ruck[len][0];
    }
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, k;
    cin >> n >> k;

    g.resize(n);
    par.resize(n);
    x.resize(k);
    good.resize(n);
    tin.resize(n);
    tout.resize(n);
    sz.resize(n);
    dp.assign(n, vi(n + 1));

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

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

        --p;
        g[p].pb(i);
        par[i] = p;
    }

    int emp = 0;

    for (int i = 0; i < n; ++i) {
        if (good[i]) {
            emp = i;
            break;
        }
    }

    int cnt = 0;

    int ans = 1;

    for (int i = 0; i < n; ++i) {
        if (good[i]) {
            ++cnt;
            continue;
        }

        ans = mul(ans, cnt + 1);
    }

    cout << ans;
}