#include <bits/stdc++.h>

using namespace std;

const long long mod = 998244353;

long long step(long long a, long long st){
    if(st == 0){
        return 1;
    }
    if(st == 1){
        return a % mod;
    }
    long long hl = step(a, st / 2);
    hl *= hl;
    hl %= mod;
    if(st % 2){
        hl *= a;
        hl %= mod;
    }
    return hl;
}

mt19937_64 rd(52);
vector<vector<long long>> g;
vector<long long> sz;

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

int main() {
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    long long n, k;
    cin >> n >> k;
    g.resize(n);
    vector<long long> outs(k);
    for(long long i = 0; i < k; i++){
        cin >> outs[i];
        outs[i]--;
    }
    for(long long i = 1; i < n; i++){
        long long ch;
        cin >> ch;
        ch--;
        g[ch].push_back(i);
    }
    sz.resize(n, 1);
    dfs(0);
    long long v = outs[0];
    long long ans = step(2, sz[v]) - 1;
    for(auto u : g[v]){
        ans -= step(2, sz[u]) - 1;
        ans += mod;
        ans %= mod;
    }
    cout << ans;
}
