#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(time(0));
constexpr int MAXN = 1e6 + 5;
constexpr int MAXK = 2e3 + 5;
constexpr int MOD = 998244353;
int pls(int a, int b){
    if (a + b >= MOD){
        return a + b - MOD;
    }
    return a + b;
}

int mns(int a, int b){
    if (a < b){
        return a - b + MOD;
    }
    return a - b;
}

int mult(int a, int b){
    return 1ll * a * b % MOD;
}

int bin_pow(int a, int n){
    if (n == 0){
        return 1;
    }
    int x = bin_pow(a, n / 2);
    if (n % 2 == 0){
        return mult(x, x);
    }
    else{
        return mult(mult(x, x), a);
    }
}

int x[MAXN];
vector <int> g[MAXN];
int sz[MAXN];
int ans = 0;
void dfs(int v){
    sz[v] = 1;
    for (auto to: g[v]){
        dfs(to);
        sz[v] += sz[to];
    }
    if (x[v]){
        ans = bin_pow(2, sz[v]);
        ans = mns(ans, 1);
        for (auto to: g[v]){
            ans = mns(ans, mns(bin_pow(2, sz[to]), 1));
        }
    }
}
void solve(){
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < k; i++){
        int a;
        cin >> a;
        a--;
        x[a] = 1;;
    }
    for (int i = 1; i < n; i++){
        int p;
        cin >> p;
        p--;
        g[p].push_back(i);
    }
    dfs(0);
    cout << ans << '\n';
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t = 1;
    while (t--){
        solve();
    }
}



