#include <bits/stdc++.h>
#define ll long long
#define int ll
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define uniq(x) x.erase(unique(all(x)), x.end())
#define fast_cin() cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0)

#pragma optimize("O3")
#pragma target("avx2")
using namespace std;

vector<int> x;
vector<vector<int>> gr;
vector<int> dp1, dp2, sz;

int mod = 998244353;

int p2(int x, int p) {
    if (p == 0) return 1;
    int res = p2(x, p/2);
    if (p&1) return res*res%mod*x%mod;
    return res*res%mod;
}

void dfs(int v) {
    int pr = 1, pr1 = 1;
    sz[v] = 1;
    for (int u: gr[v]) {
        dfs(u);
        sz[v] += sz[u];
        pr = pr*(dp1[u]+dp2[u]-1)%mod;
        pr1 = (pr1*(dp1[u]+dp2[u]))%mod;
    }
    dp1[v] = (pr+pr1)%mod;

    for (int u: gr[v]) {
        dp1[v] = (dp1[v]-(dp1[u]+dp2[u]-1)+mod)%mod;
    }
    dp1[v] = (dp1[v]-1+mod)%mod;

    dp2[v] = (p2(2, sz[v])-dp1[v]+mod)%mod;
}

signed main() {
    fast_cin();
    int n,k; cin >> n >> k;
    x.resize(k);
    gr.resize(n);
    dp1.resize(n);
    dp2.resize(n);
    sz.resize(n);

    for (int &i: x) cin >> i;
    for (int i = 1; i < n; ++i) {
        int u; cin >> u;
        gr[u-1].push_back(i);
    }

    dfs(x[0]-1);

    cout << dp1[x[0]-1];
}
