#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int N = 1100000;
const int MOD = (119 << 23) + 1;

int h[N], n, k, x[N], p[N], d[N];
vector<int> g[N];
vector<int> f[N];
bool t[N];

void dfs(int v, int mx = 0) {
    f[v] = vector<int>(mx + 2, 0);
    int m = g[v].size();
    for (int u : g[v])
        dfs(u, mx + t[v]);
    for (int c = 1; c <= mx + 1; c++) {
        int b = c + t[v];
        int ans = b;
        for (int u : g[v])
            ans = (1ll * ans * f[u][b]) % MOD;
        (f[v][c] += ans) %= MOD;
        if (t[v]) {
            int ans = 0;
            h[m] = c;
            for (int i = m - 1; i >= 0; i--)
                h[i] = (1ll * h[i + 1] * f[g[v][i]][c]) % MOD;
            int pref = 1;
            for (int i = 0; i < m; i++) {
                ans = (ans + 1ll * h[i + 1] * f[g[v][i]][c + 1] % MOD * pref) % MOD;
                pref = (1ll * pref * f[g[v][i]][c]) % MOD;
            }
            int mul = (1ll * c * (m - 1 + MOD)) % MOD;
            for (int w : g[v])
                mul = (1ll * mul * f[w][c]) % MOD;
            (ans += MOD - mul) %= MOD;
            ans = (MOD - ans) % MOD;
            (f[v][c] += ans) %= MOD;
        }
    }
}

int32_t main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n >> k;
    for (int i = 1; i <= k; i++)
        cin >> x[i];
    for (int i = 2; i <= n; i++)
        cin >> p[i];
    for (int i = 1; i <= k; i++)
        t[x[i]] = true;
    for (int i = 2; i <= n; i++)
        d[p[i]]++;
    for (int i = 1; i <= n; i++)
        g[i].reserve(d[i]);
    for (int i = 2; i <= n; i++)
        g[p[i]].push_back(i);
    dfs(1);
    cout << f[1][1];
}