#include <bits/stdc++.h>

using namespace std;

vector<int> x;
vector<vector<int>> g;
vector<int> sz;

const int mod = 998244353;

#define int int64_t

int binpow(int a,int b)
{
    return (b == 0 ? 1 : (b%2 == 0 ? binpow((a*a)%mod,b/2) : (a*binpow(a,b-1))%mod));
}

void dfs(int v)
{
    sz[v] = 1;
    for(auto u:g[v])
    {
        dfs(u);
        sz[v] += sz[u];
    }
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin >> n >> k;
    x.resize(k);
    g.resize(n);
    sz.resize(n);
    for(int i = 0;i < k;++i)
    {
        cin >> x[i];
    }
    x[0]--;
    int p[n];
    for(int i = 1;i < n;++i)
    {
        cin >> p[i];
        g[p[i]-1].push_back(i);
    }
    dfs(0);
    if(k == 1)
    {
        //cout << x[0] << ' ' 
        int s1 = sz[x[0]];
        vector<int> s2;
        for(auto u:g[x[0]])
        {
            s2.push_back(sz[u]);
        }
        //cout << s1 << endl;
        int ans = binpow(2,s1);
        for(int i = 0;i < s2.size();++i)
        {
            ans = (ans - (binpow(2,s2[i])-1) + mod) % mod;
        }
        ans = (ans - 1 + mod) % mod;
        cout << ans;
    }
}