#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <random>
#include <ctime>
#include <stack>
#include <deque>
#include <queue>
#include <climits>
#include <cmath>
using namespace std;
#define all(a) (a).begin(), (a).end()
#define mid (l + r) / 2
//#define int long long

constexpr int maxn = 1'000'001;
constexpr int maxk = 2002;
int x[maxk];
int p[maxn];
vector<int> g[maxn];
int sz[maxn];

constexpr int mod = 998'244'353;
int add(int a, int b) {
    return ((a + b < mod) ? (a + b) : (a + b - mod));
}

int sub(int a, int b) {
    return ((a < b) ? (a + mod - b) : (a - b));
}

int mul(int a, int b) {
    return (int)(((long long)(a) * (long long)(b)) % (long long)(mod));
}

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

void solve() {
    int n, k; cin >> n >> k;
    for (int i = 0; i < k; i++) {
        cin >> x[i]; x[i]--;
    }
    p[0] = -1;
    for (int i = 1; i < n; i++) {
        cin >> p[i]; p[i]--;
        g[p[i]].push_back(i);
    }
    dfs(0);
    int ans = 1;
    for (int i : g[x[0]]) {
        ans = mul(ans, add(sz[i], 1));
    }
    ans = sub(ans, 1);
    for (int i : g[x[0]]) {
        ans = sub(ans, sz[i]);
    }
    cout << ans << '\n';
}

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