// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef __int128 lll;

const ll inf=1e18+1,mod=998244353;
const ld eps=1e-9,pi=acos(-1);
#define all(a) a.begin(), a.end()
#define mpp make_pair
#define F first
#define S second

mt19937_64 rng(234);

ll binpow(ll n,ll k) {
    if (!k)
        return 1;
    if (k%2)
        return (binpow(n,k-1)*n)%mod;
    ll a=binpow(n,k/2);
    return (a*a)%mod;
}

vector<vector<int>>g;
vector<int>sz,us;
ll dfs(ll v,ll x) {
    if (!us[v]) {
        ll ans=x;
        for (auto i:g[v])
            ans=(ans*dfs(i,x))%mod;
        return ans;
    }
    vector<ll>k0,k1;
    ll ans=1,a0=1;
    for (auto i:g[v]) {
        k0.push_back(dfs(i,x));
        k1.push_back(dfs(i,x+1));
        ans=(ans*k1.back())%mod;
        a0=(a0*k0.back())%mod;
    }
    if (k0.size()==0) {
        return 1;
    }
    ll an0=ans+(((k0.size()-1)*(a0))%mod);
    for (ll i=0;i<k0.size();i++) {
        ll da0=a0;
        da0=(da0*binpow(k0[i],mod-2))%mod;
        da0=(da0*k1[i])%mod;
        an0=(an0+mod-da0)%mod;
    }
    an0=(an0+mod)%mod;
    an0=(an0*x)%mod;
    return (an0+ans)%mod;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n,k;cin>>n>>k;
    vector<ll>x(k);
    us.resize(n);
    for (auto &i:x) {
        cin>>i;
        i--;
        us[i]=1;
    }
    g.resize(n);
    sz.resize(n);
    for (ll i=1;i<n;i++) {
        ll v;cin>>v;
        g[v-1].push_back(i);
    }
    cout<<dfs(0,1);
}