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

using namespace std;
// using namespace __gnu_pbds;
// template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve();

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    int t = 1;
    while (t--) {
        solve();
    }
}

#define int long long
const int MAXN = 1e6 + 1, MOD = 998244353, INF = 2e18;

vector<int> gr[MAXN];
int pw[MAXN];

bool is[MAXN];
int sz[MAXN];
int ans = 0;
void dfs(int v) {
    sz[v]=1;
    for (int i : gr[v]) {
        dfs(i);
        sz[v] +=sz[i];
    }
    if (is[v]) {
        ans += pw[sz[v]-1];
        int pr = 1;
        int sum = 0;
        for (int i : gr[v]) {
            pr *= pw[sz[i]];
            pr %= MOD;
            sum += (pw[sz[i]]-1 + MOD) % MOD;
            sum %= MOD;
        }
        sum += 1;
        sum %= MOD;
        ans += pr;
        ans %= MOD;
        ans -= sum;
        ans += MOD;
        ans %= MOD;
    }
}

void solve() {
    int n;
    cin >> n;
    pw[0] =1;
    for (int i = 1; i <=n;i++) {
        pw[i] = pw[i-1] * 2 % MOD;
    }
    int k;
    cin >> k;
    for (int i=0; i <k;i++) {
        int x;
        cin >> x;
        x--;
        is[x] = 1;
    }
    for (int i = 1; i < n; i++) {
        int p;
        cin >> p;
        gr[p-1].push_back(i);
    }
    dfs(0);
    cout << ans;
}
