#include <bits/stdc++.h>
#define int long long
using namespace std;

const int mod = 998244353;

int binpow(int x, int n = mod - 2){
    if(n == 0) return 1;
    int y = binpow(x, n/2);
    if(n%2) return y*y%mod*x%mod;
    return y*y%mod;
}

vector<vector<int>> g, dp;
vector<bool> col;

int dfs(int i, int v){
    if(dp[i][v] == -1){
        int p0 = i;
        for(int u : g[v]){
            p0 *= dfs(i, u);
            p0 %= mod;
        }
        if(col[v]){
            int p1 = i + 1;
            for(int u : g[v]){
                p1 *= dfs(i + 1, u);
                p1 %= mod;
            }
            int s = 0;
            for(int u : g[v]){
                s += dfs(i + 1, u)*binpow(dfs(i, u));
                s %= mod;
            }
            dp[i][v] = (p1 + (g[v].size() - 1 - s + mod)*p0)%mod;
            // cout << i << ' ' << v << ' ' << dp[i][v] << ' ' << s << ' ' << p0 << ' ' << p1 << endl;
        }
        else{
            dp[i][v] = p0;
        }
    }
    return dp[i][v];
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> x(k);
    for(int &y : x){
        cin >> y;
        --y;
    }
    vector<int> p(n);
    p[0] = 0;
    for(int i = 1; i < n; ++i){
        cin >> p[i];
        --p[i];
    }
    col.resize(n);
    for(int y : x) col[y] = 1;
    g.resize(n);
    for(int i = 1; i < n; ++i){
        g[p[i]].push_back(i);
    }
    int c = k + 1;
    dp.resize(c + 1, vector<int>(n, -1));
    cout << dfs(1, 0) << endl;
}