#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <set>
#include <cstring>
#define control cout<<"e ne"<<endl;
#define endl '\n'
#define int long long
using namespace std;
int mod=998244353;
int n,k,x[2048],p,sz[1048576],parent[1048576];
vector <int> v[1048576];
void speed()
{
 ios_base::sync_with_stdio(false);
 cin.tie(0);
}
void dfs(int beg,int par)
{
    sz[beg]=1;
    parent[beg]=par;
    for(auto nb:v[beg])
    {
        if(nb!=par)
        {
            dfs(nb,beg);
            sz[beg]+=sz[nb];
        }
    }
}
signed main()
{
    /*
    #ifdef ONLINE_JUDGE
    freopen("txt.in","r",stdin)
    freopen("txt.out","w",stdout)
    #endif
    */
    speed();
    cin>>n>>k;
    for(int i=1;i<=k;i++)cin>>x[i];
    for(int i=2;i<=n;i++)
    {
        int p;
        cin>>p;
        v[p].push_back(i);
    }
    dfs(1,-1);
    int fact=1,sum=1;
    for(auto nb:v[x[1]])
    {
        if(nb==parent[x[1]])continue;
        fact*=(sz[nb]+1);
        fact%=mod;
        sum+=sz[nb];
        sum%=mod;
    }
    cout<<(2*fact-sum+mod)%mod<<endl;
    return 0;
}
