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

const ll mod=998244353;

vector<vector<ll>>G;
vector<ll>cnt;
vector<ll>dp;

void dfs(ll v) {
    cnt[v]=1;
    dp[v]=1;
    for (auto u:G[v]) {
        dfs(u);
        cnt[v]+=cnt[u];
        dp[v]*=(cnt[u]+1);
        dp[v]%=mod;
    }
    dp[v]*=2;
    dp[v]--;
    if (dp[v]<0) {
        dp[v]+=mod;
    }
    dp[v]%=mod;
    for (auto u:G[v]) {
        dp[v]-=dp[u];
        if (dp[v]<0) {
            dp[v]+=mod;
        }
    }
}

int main() {
    ll i,j,n,k,t,q;
    cin>>n>>k;
    G.assign(n,{});
    cnt.assign(n,0);
    dp.assign(n,0);
    vector<ll>prob(k);
    for (i=0;i<k;i++) {
        cin>>prob[i];
        prob[i]--;
    }
    for (i=1;i<n;i++) {
        cin>>t;
        G[t-1].push_back(i);
    }
    dfs(0);
    cout<<dp[prob[0]]<<'\n';
    return 0;
}