#include <bits/stdc++.h>

using namespace std;

void solve();

// #include<ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
#ifdef LOCAL
    freopen("input.txt","r",stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t=1;
    //cin>>t;
    while (t--) {
        solve();
    }
    return 0;
}

#define int long long
#define endl '\n'
const int N=1e6+10,MOD=998244353,INF=2e18;
const double EPS=1e-6,pi=acos(-1);
vector<int> gr[N];
bool prob[N];
bool used[N];
int s[N];
int ans=0;
int p2[N];
void dfs(int v) {
    s[v]=1;
    for (auto to:gr[v]) {
        dfs(to);
        s[v]+=s[to];
    }
    if (!prob[v])return;
    int cur=1;
    int sum=0;
    for (auto to:gr[v]) {
        cur*=p2[s[to]];
        cur%=MOD;
        sum+=p2[s[to]];
        sum%=MOD;
    }
    int val=(cur-(sum-1+MOD)%MOD+MOD)%MOD;
    cur=(cur+val)%MOD;
    ans+=cur;
}

void solve() {
    p2[0]=1;
    for (int i=1;i<N;i++) {
        p2[i]=(p2[i-1]*2)%MOD;
    }
    int n,k;
    cin>>n>>k;
    for (int i=0;i<k;i++) {
        int x;
        cin>>x;
        x--;
        prob[x]=true;
    }
    for (int i=1;i<n;i++) {
        int p;
        cin>>p;
        p--;
        gr[p].push_back(i);
    }
    dfs(0);
    cout<<ans<<endl;
}