#include<bits/stdc++.h>

#define int long long

using namespace std;

const int MAX = 1e6 + 1;
vector<int> g[MAX];
const int MOD = 998244353;

int fpow(int a, int x) {
    int ans = 1;
    while (x) {
        if (x % 2) {
            ans = (ans * a) % MOD;
        }
        a = (a * a) % MOD;
        x /= 2;
    }
    return ans;
}

int ch[MAX];
int ans = MOD - 1;
int sz[MAX];

void dfs(int v) {
    sz[v] = 1;
    for (int to : g[v]) {
        dfs(to);
        sz[v] += sz[to];
    }
    if (ch[v]) {
        ans = (ans + fpow(2, sz[v])) % MOD;
        for (int to : g[v]) {
            ans = (ans - fpow(2, sz[to]) + 1 + MOD) % MOD;
        }
    }
}

signed main() {
    ios_base::sync_with_stdio();
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < k; ++i) {
        int x;
        cin >> x;
        --x;
        ch[x] = 1;
    }
    for (int i = 1; i < n; ++i) {
        int p;
        cin >> p;
        --p;
        g[p].push_back(i);
    }
    for (int i = 0; i < n; ++i) {
        if (ch[i]) dfs(i);
    }
    cout << ans << endl;
    return 0;
}

