#include <bits/stdc++.h>

using namespace std;
#define int long long

const int N = (int) 1e6 + 10;
int n, k;

vector<int> x;
vector<int> g[N];
int sz[N];

const int mod = 998244353;

void dfs(int v, int p) {
    sz[v] = 1;
    for (auto u: g[v]) {
        dfs(u, v);
        sz[v] += sz[u];
    }
}

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

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> k;
    x.resize(k);
    for (int i = 0; i < k; i++) cin >> x[i], x[i]--;
    for (int i = 1; i < n; i++) {
        int pr;
        cin >> pr;
        g[pr - 1].emplace_back(i);
    }
    dfs(x[0], -1);
    int res = (binpow(2, sz[x[0]] - 1)), add = (res - 1 + mod) % mod;
    for (auto u: g[x[0]]) {
        add = (add - binpow(2, sz[u]) + 1 + mod) % mod;
    }
    res = (res + add) % mod;
    cout << res;
    return 0;
}
