#include <bits/stdc++.h>

using namespace std;

#ifndef lisie_bimbi
#define endl '\n'
#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2,bmi2,fma")
#endif

using ll = long long;

const int mod = 998'244'353;
const int gg = 3;

int add(int a, int b){
    if(a + b < mod){
        return a + b;
    }else{
        return a + b - mod;
    }
}

int sub(int a, int b){
    if(a >= b){
        return a - b;
    }else{
        return a - b + mod;
    }
}

int mul(int a, int b){
    return ((ll)a * b) % mod;
}

int binpow(int a, int b){
    if(b == 0){
        return 1;
    }
    int ans = binpow(a, b / 2);
    ans = mul(ans, ans);
    if(b % 2 == 1){
        ans = mul(ans, a);
    }
    return ans;
}

int del(int a, int b){
    return mul(a, binpow(b, mod - 2));
}

void fft(vector<int> &a){
    int n = a.size();
    vector<int> pows(n + 1);
    pows[0] = 1;
    int g = binpow(gg, (mod - 1) / n);
    for(int i = 1; i <= n; i++){
        pows[i] = mul(pows[i - 1], g);
    }
    vector<int> w(n);
    w[0] = n;
    for(int sz = n; sz > 1; sz >>= 1){
        for(int i = 0; i < n; i += sz){
            w[i] /= 2;
            w[i + sz / 2] = w[i] + n / 2;
            for(int j = i; j < i + sz / 2; j++){
                int x = a[j], y = a[j + sz / 2];
                a[j] = add(x, mul(y, pows[w[i]]));
                a[j + sz / 2] = add(x, mul(y, pows[w[i + sz / 2]]));
            }
        }
    }
}


void revfft(vector<int> &a){
    int n = a.size();
    vector<int> pows(n + 1);
    pows[0] = 1;
    int g = binpow(gg, (mod - 1) / n);
    for(int i = 1; i <= n; i++){
        pows[i] = mul(pows[i - 1], g);
    }
    vector<int> w(n);
    w[0] = n;
    for(int sz = n; sz > 1; sz >>= 1){
        for(int i = 0; i < n; i += sz){
            w[i] /= 2;
            w[i + sz / 2] = w[i] + n / 2;
        }
    }
    int inv2 = del(1, 2);
    for(int sz = 2; sz <= n; sz <<= 1){
        for(int i = 0; i < n; i += sz){
            for(int j = i; j < i + sz / 2; j++){
                int x = a[j], y = a[j + sz / 2];
                a[j] = mul(add(x, y), inv2);
                a[j + sz / 2] = mul(mul(sub(x, y), inv2), pows[n - w[i]]);
            }
            w[i] *= 2;
            w[i + sz / 2] = 0;
        }
    }
}

vector<int> mulv(vector<int> a, vector<int> b){
    int n1 = a.size() - 1 + b.size() - 1;
    int n = 1;
    while(n < n1 + 1){
        n *= 2;
    }
    a.resize(n);
    b.resize(n);
    fft(a);
    fft(b);
    for(int i = 0; i < n; i++){
        a[i] = mul(a[i], b[i]);
    }
    revfft(a);
    while((a.size() > 1) && (a.back() == 0)){
        a.pop_back();
    }
    return a;
}

vector<int> addv(vector<int> a, vector<int> b){
    vector<int> ans(max(a.size(), b.size()));
    for(int i = 0; i < a.size(); i++){
        ans[i] = add(ans[i], a[i]);
    }
    for(int i = 0; i < b.size(); i++){
        ans[i] = add(ans[i], b[i]);
    }
    return ans;
}

vector<int> subv(vector<int> a, vector<int> b){
    vector<int> ans(max(a.size(), b.size()));
    for(int i = 0; i < a.size(); i++){
        ans[i] = add(ans[i], a[i]);
    }
    for(int i = 0; i < b.size(); i++){
        ans[i] = sub(ans[i], b[i]);
    }
    return ans;
}

const int N = 100'000;

int fac[N], invfac[N];

int cnk(int n, int k){
    if((k > n) || (n < 0) || (k < 0)){
        return 0;
    }
    return mul(fac[n], mul(invfac[k], invfac[n - k]));
}

vector<int> f(vector<int> a){
    vector<int> ans(a.size());
    for(int i = 0; i < a.size(); i++){
        for(int j = i; j < a.size(); j++){
            ans[i] = add(ans[i], mul(a[j], cnk(j, i)));
            // cout << a[j] << ' ' << cnk(j, i) << endl;
        }
    }
    // cout << "xxxxxx\n";
    // for(auto i : a){
    //     cout << i << ' ';
    // }
    // cout << endl;
    // for(auto i : ans){
    //     cout << i << ' ';
    // }
    // cout << endl;
    return ans;
}

vector<vector<int>> v;
vector<vector<int>> p;
vector<int> popa;

vector<int> shift(vector<int> a, int x){
    vector<int> ans(a.size() + x);
    for(int i = 0; i < a.size(); i++){
        ans[i + x] = a[i];
    }
    return ans;
}

void vivo(vector<int> a){
    for(auto i : a){
        cout << i << ' ';
    }
    cout << endl;
}


void dfs(int u){
    vector<int> m = {1};
    vector<int> fm2 = {1};
    for(auto i : v[u]){
        dfs(i);
        m = mulv(m, p[i]);
        fm2 = mulv(fm2, f(p[i]));
    }
    vector<int> fm = f(m);
    if(!popa[u]){
        p[u] = shift(m, 1);
    }else{
        vector<int> z = fm;
        for(auto i : v[u]){
            vector<int> s =subv(f(p[i]), p[i]);
            for(auto j : v[u]){
                if(j == i){
                    continue;
                }
                s = mulv(s, p[j]);
            }
            z = subv(z, s);
        }
        z = subv(z, m);
        z = shift(z, 1);
        z = addv(z, fm);
        p[u] = z;
    }
}

int now = 0;

vector<int> o;

void dfs2(int u){
    if(!popa[u]){
        o.push_back(0);
    }else{
        o.push_back(1);
    }
    if(v[u].size()){
        dfs2(v[u][0]);
    }
}

vector<int> sz;
vector<int> ans;

void dfs1(int u){
    sz[u] = 1;
    for(auto i : v[u]){
        dfs1(i);
        sz[u] += sz[i];
    }
    if(popa[u]){
        ans[u] = binpow(2, sz[u]);
        ans[u] = sub(ans[u], 1);
        for(auto i : v[u]){
            ans[u] = sub(ans[u], sub(binpow(2, sz[i]), 1));
        }
    }
}

vector<vector<int>> c;

vector<int> calc(int l, int r){
    if(l + 1 == r){
        return c[l];
    }
    int m = (l + r) / 2;
    return mulv(calc(l, m), calc(m, r));
}

void solve(){
    fac[0] = 1;
    for(int i = 1; i < N; i++){
        fac[i] = mul(fac[i - 1], i);
    }
    invfac[N - 1] = del(1, fac[N - 1]);
    for(int i = N - 2; i >= 0; i--){
        invfac[i] = mul(invfac[i + 1], i + 1);
    }
    int n, k;
    cin >> n >> k;
    popa.resize(n);
    for(int i = 0; i < k; i++){
        int x;
        cin >> x;
        x--;
        popa[x] = 1;
    }
    v.resize(n);
    p.resize(n);
    for(int i = 1; i < n; i++){
        int par;
        cin >> par;
        par--;
        v[par].push_back(i);
    }
    dfs2(0);
    reverse(o.begin(), o.end());
    int now = 0;
    int ans = 1;
    for(int i = 0; i < n; i++){
        if(o[i] == 0){
            ans = mul(ans, now + 1);
        }else{
            now++;
        }
    }
}

signed main(){
#ifdef lisie_bimbi
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);   
#else
    cin.tie(nullptr)->sync_with_stdio(false);
#endif         
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}