#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

const int maxn = 1e6 + 1;
vector <int> g[maxn];
const ll mod = 998244353LL;
bool task[maxn];
ll sz[maxn];
ll ans = 1;
void dfs(int v) {
    sz[v] = 1;
    for (auto u : g[v]) {
        dfs(u);
        sz[v] += sz[u];
    }
    if (task[v]) {
        for (auto u : g[v]) {
            ans = (ans * (sz[u] + 1)) % mod;
        }
        ans = (ans * 2) % mod;
        ans = ((ans - sz[v]) % mod + mod) % mod;
    }
}

void solve() {
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < k; i++) {
        int c;
        cin >> c;
        task[c] = true;
    }
    for (int i = 2; i <= n; i++) {
        int p;
        cin >> p;
        g[p].push_back(i);
    }
    assert(k == 1);
    dfs(1);
    cout << ans;
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}

// Halal code
