// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(x) x.begin(), x.end()

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")

const int MOD = 998244353;
const int MAXN = 501;

int bin_pow(int x, int y) {
    if (!y) return 1;
    if (y % 2) return x * bin_pow(x, y - 1) % MOD;
    int res = bin_pow(x, y / 2);
    return res * res % MOD;
}

int fact[MAXN];
int rev_fact[MAXN];
int C[MAXN][MAXN];

vector<vector<int>> graph;
vector<vector<int>> dp;
vector<bool> is_special;

void dfs(int v, int p) {
    dp[v] = {1};
    vector<vector<int>> pref_dp = {dp[v]};
    for (auto u : graph[v]) {
        if (u != p) {
            dfs(u, v);
            vector<int> new_dp(dp[v].size() - 1 + dp[u].size() - 1 + 1, 0);
            for (int i = 0; i < dp[v].size(); i++) {
                for (int j = 0; j < dp[u].size(); j++) {
                    new_dp[i + j] += dp[v][i] * dp[u][j];
                    new_dp[i + j] %= MOD;
                }
            }
            dp[v] = new_dp;
            pref_dp.push_back(dp[v]);
        } else {
            pref_dp.push_back(pref_dp.back());
        }
    }
    if (!is_special[v]) {
        vector<int> dp_res(dp[v].size() + 1, 0);
        for (int i = 0; i < (int)dp[v].size(); i++) {
            dp_res[i + 1] = dp[v][i];
            dp_res[i + 1] %= MOD;
        }
        dp[v] = dp_res;
        return;
    }
//    cout << "v = " << v << endl;
    dp[v] = {1};
    reverse(all(graph[v]));
    vector<vector<int>> suf_dp = {dp[v]};
    for (auto u : graph[v]) {
        if (u != p) {
            vector<int> new_dp(dp[v].size() - 1 + dp[u].size() - 1 + 1, 0);
            for (int i = 0; i < dp[v].size(); i++) {
                for (int j = 0; j < dp[u].size(); j++) {
                    new_dp[i + j] += dp[v][i] * dp[u][j];
                    new_dp[i + j] %= MOD;
                }
            }
            dp[v] = new_dp;
            suf_dp.push_back(dp[v]);
        } else {
            suf_dp.push_back(suf_dp.back());
        }
    }
    reverse(all(graph[v]));
    reverse(all(suf_dp));
    /*
    for (auto num : dp[v]) {
        cout << num << " dp[v] ";
    }
    cout << endl;
    */
    vector<vector<int>> dp_bad(dp[v].size(), vector<int>(dp[v].size(), 0));
    for (int i = 0; i < (int)graph[v].size(); i++) {
        if (graph[v][i] == p) continue;
        int u = graph[v][i];
        vector<int> dp1 = pref_dp[i];
        vector<int> dp2 = suf_dp[i + 1];
        vector<int> dp_others(dp1.size() + dp2.size() - 1, 0);
        for (int j = 0; j < (int)dp1.size(); j++) {
            for (int k = 0; k < (int)dp2.size(); k++) {
                dp_others[j + k] += dp1[j] * dp2[k];
                dp_others[j + k] %= MOD;
            }
        }
        for (int j = 0; j < (int)dp_others.size(); j++) {
            for (int k = 0; k < (int)dp[u].size(); k++) {
                dp_bad[j + k][k] += dp_others[j] * dp[u][k];
                dp_bad[j + k][k] %= MOD;
            }
        }
    }
    vector<int> dp_res(dp[v].size(), 0);
    dp_res.push_back(0);
    for (int i = 0; i < dp_bad.size(); i++) {
        for (int j = 1; j <= i; j++) {
            int cur_ans = C[i][j] * dp[v][i];
//            cout << i << " " << j << " before " << cur_ans << " " << dp[v][i] << endl;
            for (int k = j; k < dp_bad.size(); k++) {
                cur_ans -= C[k][j] * dp_bad[i][k];
                cur_ans = (cur_ans % MOD + MOD) % MOD;
//                cout << k << " dp_bad " << dp_bad[i][k] << endl;
            }
//            cout << "after = " << cur_ans << endl;
            dp_res[i - j + 1] += cur_ans;
            dp_res[i - j + 1] %= MOD;
        }
    }
    for (int i = 0; i < dp[v].size(); i++) {
        for (int j = 0; j <= i; j++) {
            dp_res[i - j] += dp[v][i] * C[i][j];
            dp_res[i - j] %= MOD;
        }
    }
    dp[v] = dp_res;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    fact[0] = 1;
    for (int i = 1; i < MAXN; i++) {
        fact[i] = fact[i - 1] * i % MOD;
    }
    rev_fact[MAXN - 1] = bin_pow(fact[MAXN - 1], MOD - 2);
    for (int i = MAXN - 2; i >= 0; i--) {
        rev_fact[i] = rev_fact[i + 1] * (i + 1) % MOD;
    }
    for (int i = 0; i < MAXN; i++) {
        for (int j = 0; j <= i; j++) {
            C[i][j] = fact[i] * rev_fact[j] % MOD * rev_fact[i - j] % MOD;
        }
    }
    int n, k;
    cin >> n >> k;
    vector<int> x(k);
    is_special.resize(n, false);
    for (int i = 0; i < k; i++) {
        cin >> x[i];
        x[i]--;
        is_special[x[i]] = true;
    }
    graph.resize(n);
    vector<int> p(n - 1);
    for (int i = 0; i < n - 1; i++) {
        cin >> p[i];
        p[i]--;
        graph[p[i]].push_back(i + 1);
        graph[i + 1].push_back(p[i]);
    }
    dp.resize(n);
    dfs(0, 0);
    int ans = 0;
    for (auto num : dp[0]) {
        ans += num;
        ans %= MOD;
    }
    cout << (ans % MOD + MOD) % MOD << endl;
    return 0;
}
