#include <bits/stdc++.h>
#define int long long
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ff first
#define ss second

using namespace std;

const int mod = 998244353;

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

vector <vector <int>> g;
vector <int> sz;
vector <bool> mark;
vector <int> give;
vector <int> allv;
vector <int> ans;

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

void dfs(int v) {
    for (auto u : g[v]) {
        dfs(u);
    }
    if (!mark[v]) {
        if (g[v].size() == 0) {
            give[v] = 1;
            allv[v] = 2;
            ans[v] = 1;
        } else if (g[v].size() == 1) {
            give[v] = give[g[v][0]] + allv[g[v][0]];
            allv[v] = 2 * allv[g[v][0]];
            ans[v] = ans[g[v][0]];
        } else {
            int u1 = g[v][0];
            int u2 = g[v][1];
            allv[v] = 2 * allv[u1] * allv[u2];
            give[v] = give[u1] * allv[u2] + give[u2] * allv[u1] - give[u1] * give[u2] + allv[u1] * allv[u2];
            ans[v] = ans[u1] * ans[u2];
        }
    } else {
        if (g[v].size() == 0) {
            give[v] = 0;
            allv[v] = 1;
            ans[v] = 1;
        } else if (g[v].size() == 1) {
            ans[v] = give[g[v][0]];
            give[v] = give[g[v][0]] + allv[g[v][0]];
            allv[v] = 2 * allv[g[v][0]];
        } else {
            int u1 = g[v][0];
            int u2 = g[v][1];
            ans[v] = give[u1] * give[u2] + allv[u1] * allv[u2];
            give[v] = give[u1] * allv[u2] + give[u2] * allv[u1] - give[u1] * give[u2] + give[u1] + give[u2] + 1;
            allv[v] = give[v] + ans[v];
        }
    }
    give[v] %= mod;
    allv[v] %= mod;
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector <int> a(k);
    for (int i = 0; i < k; ++i) {
        cin >> a[i];
    }
    bool f = true;
    g.assign(n + 1, {});
    sz.assign(n + 1, 0);
    for (int i = 2; i <= n; ++i) {
        int x;
        cin >> x;
        g[x].push_back(i);
        if (x != i - 1) f = false;
    }
    if (k == 1) {
        calc_s(1);
        int v = a[0];
        int ans = binpow(2, sz[v]) - 1;
        for (auto u : g[v]) {
            ans -= binpow(2, sz[u]) - 1;
            if (ans < 0)
                ans += mod;
        }
        cout << ans;
        return;
    }
    if (f) {
        sort(all(a));
        int ans = 1;
        int ind = 0;
        for (int i = 1; i <= n; ++i) {
            if (ind < k && a[ind] == i) ++ind;
            else ans *= ind + 1;
            ans %= mod;
        }
        cout << ans;
        return;
    }
    mark.assign(n + 1, 0);
    give.assign(n + 1, 0);
    allv.assign(n + 1, 0);
    ans.assign(n + 1, 1);
    for (auto v : a) {
        mark[v] = 1;
    }
    dfs(1);
    cout << ans[1];
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    int t = 1;
    while (t--) solve(), cout << '\n';
}
