#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, gg;
vector<bool> col;
vector<int> sz;

void dfs0(int i, int v){
    if(col[v]){
        gg[i].push_back(v);
        return;
    }
    ++sz[i];
    for(int u : g[v]) dfs0(i, u);
}

int c;

int dfs(int i, int v){
    if(dp[v].size() == 0) dp[v].resize(c + 1, -1);
    if(dp[v][i] == -1){
        int ans;
        if(col[v]){
            int p0 = i;
            for(int u : g[v]){
                p0 *= dfs(i, u);
                p0 %= mod;
            }
            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;
            }
            ans = (p1 + (g[v].size() - 1 - s + mod)*p0)%mod;
            // cout << i << ' ' << v << ' ' << dp[i][v] << ' ' << s << ' ' << p0 << ' ' << p1 << endl;
        }
        else{
            ans = binpow(i, sz[v]);
            for(int u : gg[v]){
                ans *= dfs(i, u);
                ans %= mod;
            }
        }
        dp[v][i] = ans;
    }
    return dp[v][i];
}

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);
    }
    gg.resize(n);
    sz.resize(n);
    for(int v : x) for(int u : g[v]){
        dfs0(u, u);
    }
    dfs0(0, 0);
    c = k + 1;
    dp.resize(n);
    cout << dfs(1, 0) << endl;
}