#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);
}

const int b = 20;
int c;

vector<vector<int>> pw;

void f(vector<int> &s, vector<int> &ans){
    vector<int> t, cnt(b);
    for(int x : s){
        if(x < b) cnt[x]++;
        else t.push_back(x);
    }
    for(int i = 1; i < b; ++i){
        if(cnt[i] > 0){
            for(int j = 1; j < c; ++j){
                ans[j] += cnt[i]*pw[i][j];
            }
        }
    }
    for(int i = 1; i < c; ++i){
        int x = pw[1][i];
        for(int y : t) ans[i] += binpow(x, y);
        ans[i] %= mod;
    }
}

void init(){
    pw.resize(b);
    pw[1].resize(c);
    for(int i = 1; i < c; ++i){
        pw[1][i] = (i + 1)*binpow(i)%mod;
    }
    for(int j = 2; j < b; ++j){
        pw[j].resize(c);
        for(int i = 1; i < c; ++i){
            pw[j][i] = pw[j - 1][i] * pw[1][i] % mod;
        }
    }
}

int dfs(int i, int v){
    if(i > c || (col[v] && i == c)) return 0;
    if(dp[v].size() == 0) dp[v].resize(c + 1, -1);
    if(dp[v][i] == -1){
        if(col[v]){
            vector<int> szu;
            vector<vector<int>> ansu(c + 1);
            int k = 0;
            for(int u : g[v]){
                if(gg[u].size() == 0){
                    szu.push_back(sz[u]);
                }
                else{
                    ++k;
                    for(int i = 1; i <= c; ++i){
                        ansu[i].push_back(dfs(i, u));
                    }
                }
            }
            int ssz = 0;
            for(int x : szu) ssz += x;
            vector<int> sums(c);
            f(szu, sums);
            for(int i = 1; i < c; ++i){
                int p0 = binpow(i, ssz + 1);
                for(int x : ansu[i]){
                    p0 *= x;
                    p0 %= mod;
                }
                int p1 = binpow(i + 1, ssz + 1);
                for(int x : ansu[i + 1]){
                    p1 *= x;
                    p1 %= mod;
                }
                int s = sums[i];
                for(int j = 0; j < k; ++j){
                    s += ansu[i + 1][j]*binpow(ansu[i][j]);
                    s %= mod;
                }
                dp[v][i] = (p1 + (g[v].size() - 1 - s + mod)*p0)%mod;
            }
            // cout << i << ' ' << v << ' ' << dp[i][v] << ' ' << s << ' ' << p0 << ' ' << p1 << endl;
        }
        else{
            int 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);
    init();
    cout << dfs(1, 0) << endl;
}