#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <random>
#include <deque>
#include <queue>
#include <unordered_set>
#include <unordered_map>

#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define int long long

using namespace std;

mt19937 rnd(52);

typedef long long ll;
typedef long double ld;

const ll MAXN = 1e6 + 1;
const ll MOD = 998244353;
const ll INF = 1e18;

vector<vector<int>> g(MAXN);
vector<int> sz(MAXN);

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


void solve(){
    int n, k;
    cin >> n >> k;
    vector<int> arr(k);
    for(int i = 0; i < k; i++){
        cin >> arr[i];
    }
    sort(all(arr));
    for(int i = 2; i <= n; i++){
        int p;
        cin >> p;
        g[p].push_back(i);
    }
    dfs(1);
    if(k == 1){
        int ans = 0;
        int mnoh = 1;
        int sum = 0;
        for(auto u: g[arr[0]]){
            ans += mnoh * sz[u];
            ans %= MOD;
            mnoh *= (sz[u] + 1);
            mnoh %= MOD;
            sum += sz[u];
        }
        ans = (2 * ans - sum + MOD + 1) % MOD;
        cout << ans << endl;
    }
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}