#pragma GCC optimize("O3,unroll-loops")
///#pragma GCC optimize("Ofast")
#include <vector>
#pragma GCC target("avx2")
#include <bits/stdc++.h>

using namespace std;

#define int long long
using ld = long double;

mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());

int mod = 998244353;

int binpow(int x, int n) {
    if (n == 0) {
        return 1;
    }
    if (n % 2 == 0) {
        return binpow(x*x%mod, n/2);
    }
    return binpow(x*x%mod, n/2) * x % mod;
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vector <int> x(k);
    for (int i = 0; i < k; i++) {
        cin >> x[i];
    }
    vector <int> p(n-1);
    for (int i = 0; i < n-1; i++) {
        cin >> p[i];
        p[i]--;
    }
    vector <vector <int>> rev(n);
    for (int i = 1; i < n; i++) {
        rev[p[i-1]].push_back(i);
    }
    vector <int> dp(n), dp1(n);
    for (int i = n-1; i >= 0; i--) {
        if (rev[i].size() == 0) {
            dp[i] = 1;
            dp1[i] = 1;
            continue;
        }
        int ans = 2;
        for (auto u : rev[i]) {
            ans *= (dp[u]+1);
            ans %= mod;
        }
        ans--;
        ans += mod;
        ans %= mod;
        dp[i] = ans;
        for (auto u : rev[i]) {
            ans -= dp[u];
            ans += mod;
            ans %= mod;
        }
        dp1[i] = ans;
    }
    cout << dp1[x[0]-1];
}
