#include <bits/stdc++.h>

using namespace std;

const long long mod = 998244353;
const int MAXN = 1e6+5;

int n,k;
int x[2005],p[MAXN];
vector<int>g[MAXN];
long long tw[MAXN];

void read()
{
    cin >> n >> k;
    for(int i = 1; i <= k; i++) cin >> x[i];
    for(int i = 2; i <= n; i++)
    {
        cin >> p[i];
        g[p[i]].push_back(i);
    }
    tw[0] = 1;
    for(int i = 1; i <= n; i++) tw[i] = (tw[i-1]*2)%mod;
}

int sub[MAXN];
void dfs_sub(int beg)
{
    for(int nb : g[beg])
    {
        dfs_sub(nb);
        sub[beg] += sub[nb];
    }
    sub[beg]++;
}

void solve()
{
    dfs_sub(1);

    int ver = x[1];

    int sz = sub[ver] - 1;
    long long ans = 1LL*tw[sz];

    long long ans2 = (tw[sz]-1+mod)%mod;
    for(int nb : g[ver])
    {
        ans2 = (ans2 - tw[sub[nb]] + mod + 1)%mod;
    }
    cout << (ans + ans2)%mod << endl;

}

int main()
{
    read();
    solve();
return 0;
}
