#include <bits/stdc++.h>

using namespace std;
using ll=long long;
using ld=long double;
using ull=unsigned long long;
using lll=__int128;

#ifdef LOCAL
#define deb(x) cout<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
#else
#define deb(x)
#endif
#define all(x) x.begin(), x.end()
#define arr(x) x.rbegin(), x.rend()
#define int ll
constexpr int MOD=998244353, MAX_N=1e6;
vector<int> a[MAX_N];
bool xx[MAX_N];
bool us[MAX_N];
int sz[MAX_N];
vector<vector<int>> dp, ss;
int n;
int l[MAX_N], r[MAX_N];
int C(int n, int k) {
    return (((l[n]*r[k])%MOD)*r[n-k])%MOD;
}
int pw(int x, int y) {
    if (y==0) return 1;
    if (y%2==0) return pw((x*x)%MOD, y/2);
    return (x*pw(x,y-1))%MOD;
}
void dfs(int p, int pr) {
    sz[p]=1;
    int q=1;
    dp[p].assign(n+1,0);
    ss[p].assign(n+1,0);
    dp[p][0]=dp[p][1]=1;
    for (auto i: a[p]) {
        if (i==pr) continue;
        dfs(i,p);
        q*=dp[i][sz[i]];
        q%=MOD;
        sz[p]+=sz[i];
        vector<int> z(n+1);
        for (auto j=0; j<=n; ++j) {
            for (auto e=0; e<=sz[i]; ++e) {
                if (j+e<=n) z[j+e]+=(dp[p][j]*dp[i][e])%MOD;
            }
        }
        for (auto& i: z) i%=MOD;
        dp[p]=z;
    }
    if (xx[p]) {
        dp[p][0]=0;
        for (auto j: a[p]) {
            if (j==pr) continue;
            for (auto e=1; e<=sz[j]; ++e) {
                deb(j)
                deb(e)
                deb(C(sz[j],e))
                deb(sz[j]-e)
                deb(ss[j][sz[j]-e])
                deb(q)
                deb(dp[j][sz[j]])
                dp[p][e]-=((C(sz[j],e)*ss[j][sz[j]-e])%MOD)*((q*pw(dp[j][sz[j]],MOD-2))%MOD);
                dp[p][e]%=MOD;
                if (dp[p][e]<0) dp[p][e]+=MOD;
            }
        }
    }
    ss[p][0]=dp[p][0];
    for (auto i=1; i<=n; ++i) ss[p][i]=(ss[p][i-1]+dp[p][i])%MOD;
}
signed main(){
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    l[0]=1;
    for (auto i=1; i<MAX_N; ++i) l[i]=(l[i-1]*i)%MOD;
    r[MAX_N-1]=pw(l[MAX_N-1], MOD-2);
    for (auto i=MAX_N-2; i>=0; --i) r[i]=(r[i+1]*(i+1))%MOD;
    int k;
    cin>>n>>k;
    dp.resize(n);
    ss.resize(n);
    int cc;
    for (auto i=0; i<k; ++i) {
        int c;
        cin>>c;
        xx[c-1]=1;
        cc=c-1;
    }
    vector<int> g(n,1);
    int ans=1;
    for (auto i=0; i<n; ++i) {
        if (i) g[i]=g[i-1];
        if (xx[i]) g[i]++;
        else ans*=g[i];
        ans%=MOD;
    }
    //cout<<ans;
    vector<int> p(n);
    for (auto i=1; i<n; ++i) {
        cin>>p[i];
        p[i]--;
        a[p[i]].push_back(i);
    }
    dfs(0,0);
    cout<<pw(2,sz[cc]);
}
