#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
using namespace std;
const long long mod = 998244353;
const int w = 1e5;
vector<long long> F(w + 1), oF(w + 1);

inline long long obr(long long a)
{
    long long res = 1, t = a, b = mod - 2;
    while (b)
    {
        if (b & 1)
            (res *= t) %= mod;
        (t *= t) %= mod;
        b >>= 1;
    }
    return res;
}

inline long long C(int n, int k)
{
    if (k < 0 || k > n)
        return 0;
    return F[n] * oF[k] % mod * oF[n - k] % mod;
}

void dfs(vector<vector<int>>& g, vector<int>& s, vector<bool>& isx, vector<vector<array<long long, 3>>>& dp, int v)
{
    for (int i : g[v])
    {
        dfs(g, s, isx, dp, i);
        s[v] += s[i];
    }
    dp[v].resize(s[v] + 1, {0, 0, 0});
    if (isx[v])
    {
        dp[v][1][0] = 1;
        dp[v][0][2] = 1;
        for (int t : g[v])
        {
            vector<array<long long, 3>> ndp(s[v] + 1, {0, 0, 0});
            for (int j = 0; j <= s[v]; ++j)
                if (dp[v][j][0] || dp[v][j][1] || dp[v][j][2])
                    for (int x = 0; x <= s[t]; ++x)
                        if (dp[t][x][2])
                        {
                            for (int p = 0; p < 3; ++p)
                                (ndp[j + x][p] += dp[v][j][p] * dp[t][x][2]) %= mod;
                            for (int k = 0; k < x; ++k)
                                for (int p = 0; p < 3; ++p)
                                    (ndp[j + k][min(p + 1, 2)] += dp[v][j][p] * dp[t][x][2] % mod * C(x, k)) %= mod;
                        }
            swap(dp[v], ndp);
        }
    }
    else
    {
        dp[v][1][2] = 1;
        for (int t : g[v])
        {
            vector<array<long long, 3>> ndp(s[v] + 1, {0, 0, 0});
            for (int j = 0; j <= s[v]; ++j)
                if (dp[v][j][2])
                    for (int x = 0; x <= s[t]; ++x)
                        if (dp[t][x][2])
                            (ndp[j + x][2] += dp[v][j][2] * dp[t][x][2]) %= mod;
            swap(dp[v], ndp);
        }
    }
}

int main()
{
    F[0] = 1;
    for (int i = 1; i <= w; ++i)
        F[i] = F[i - 1] * i % mod;
    oF[w] = obr(F[w]);
    for (int i = w; i; --i)
        oF[i - 1] = oF[i] * i % mod;
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, kx;
    cin >> n >> kx;
    vector<bool> isx(n, false);
    while (kx--)
    {
        int x;
        cin >> x;
        --x;
        isx[x] = true;
    }
    vector<vector<int>> g(n);
    for (int i = 1; i < n; ++i)
    {
        int pi;
        cin >> pi;
        --pi;
        g[pi].push_back(i);
    }
    vector<vector<array<long long, 3>>> dp(n);
    vector<int> s(n, 1);
    dfs(g, s, isx, dp, 0);
    long long ans = 0;
    for (int j = 0; j <= n; ++j)
        (ans += dp[0][j][2]) %= mod;
    cout << ans;
    return 0;
}
