#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<ll>gr[1000002];
ll n, k, i,cl[1000002],tin[1000002],tout[1000002],timer,x, dp[1002][1002],p[1000002], pr[1000002],ans,s[1000002],j,lca[1002][1002],mod=998244353;
void dfs(ll v) {
    tin[v]=timer++;
    s[v]=1;
    for (auto u:gr[v]) {
        dfs(u);
        s[v]+=s[u];
    }
    tout[v]=timer++;
}
void rec(ll j) {
    if (j==n+1) {

    }
}
ll pow2(ll a, ll b) {
    if (b==0) {
        return 1ll;
    }
    ll s=pow2(a, b/2);
    if (b%2==0) {
        return (s*s)%mod;
    }else {
        return (((s*s)%mod)*a)%mod;
    }
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> k;
    for (i=0;i<k;i++) {
        cin >> x;
        cl[x]=1;
    }
    for (i=n;i>=1;i--) {
        pr[i]=pr[i+1]+cl[i];
    }
    for (i=2;i<=n;i++) {
        cin >> p[i];
        gr[p[i]].push_back(i);
    }
    ans=1;
    for (i=1;i<=n;i++) {
        if (!cl[i]) {
            ans*=(pr[i]+1);
            ans%=mod;
        }
    }
    cout << ans;
    return 0;
    dfs(1);
    if (k==1) {
        for (i=1;i<=n;i++) {
            if (cl[i]) {
                ans=2;
                for (auto u:gr[i]) {
                    ans*=(pow2(2, s[u]));
                    ans%=mod;
                }
                for (auto u:gr[i]) {
                    ans-=pow2(2, s[u])-1;
                    ans+=mod;
                    ans%=mod;
                }
                ans+=mod;
                ans--;
                ans%=mod;
                cout << ans;
                return 0;
            }
        }
    }
    for (i=1;i<=n;i++) {
        for (j=1;j<=n;j++) {
            x=i;
            while (!(tin[x]<=tin[j] && tout[j]<=tout[x])) {
                x=p[x];
            }
            lca[i][j]=x;
        }
    }
    rec(1);
    return 0;
}
