#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], cnt[N], smx[N];
vector<int> g[N], s[N], f[N];
bool t[N];

int binpow(int n, int k) {
    int ans = 1;
    while (k) {
        if (k & 1) ans = (1ll * ans * n) % MOD;
        n = (1ll * n * n) % MOD;
        k /= 2;
    }
    return ans;
}

int inv(int c) {
    return binpow(c, MOD - 2);
}

void dfs(int v, int mx = 0) {
    smx[v] = mx;
    for (int u : g[v])
        dfs(u, mx + t[v]);
    if (!t[v]) {
        cnt[v] = 1;
        for (int u : g[v]) {
            cnt[v] += cnt[u];
            if (s[u].size() > s[v].size())
                s[u].swap(s[v]);
            for (int x : s[u])
                s[v].push_back(x);
            s[u].clear();
        }
        return;
    }
    cnt[v] = 0;
    s[v].push_back(v);
    f[v] = vector<int>(mx + 2, 0);
    vector<int> rr, ru;
    int sum = 0;
    for (int u : g[v]) {
        if (s[u].empty()) {
            sum += cnt[u];
            ru.push_back(cnt[u]);
        } else rr.push_back(u);
    }
    for (int u : rr) {
        if (cnt[u] == 0)
            continue;
        f[u] = vector<int>(smx[u] + 2, 0);
        for (int c = 1; c <= smx[u] + 1; c++) {
            f[u][c] = binpow(c, cnt[u]);
            for (int w : s[u])
                f[u][c] = (1ll * f[u][c] * f[w][c]) % MOD;
        }
    }
    int m = rr.size();
    for (int c = 1; c <= mx + 1; c++) {
        int b = c + 1;
        int ans = binpow(b, sum + 1);
        for (int u : rr)
            ans = (1ll * ans * f[u][b]) % MOD;
        (f[v][c] += ans) %= MOD;
        ans = 0;
        h[m] = binpow(c, sum + 1);
        for (int i = m - 1; i >= 0; i--)
            h[i] = (1ll * h[i + 1] * f[rr[i]][c]) % MOD;
        int pref = 1;
        for (int i = 0; i < m; i++) {
            ans = (ans + 1ll * h[i + 1] * f[rr[i]][c + 1] % MOD * pref) % MOD;
            pref = (1ll * pref * f[rr[i]][c]) % MOD;
        }
        int d = 1ll * (c + 1) * inv(c) % MOD;
        ll sum = 0;
        for (int u : ru) {
            int val = 1ll;
            for (int i = 1; i <= u; i++)
                val = (1ll * val * d) % MOD;
            sum += val;
        }
        sum = sum % MOD;
        ans = (ans + h[0] * sum) % MOD;
        int mul = (1ll * c * (g[v].size() - 1 + MOD)) % MOD;
        mul = (1ll * mul * binpow(c, sum)) % MOD;
        for (int w : rr)
            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++)
        g[p[i]].push_back(i);
    dfs(1);
    int ans = 1;
    for (int u : s[1])
        ans = (1ll * ans * f[u][1]) % MOD;
    cout << ans;
}