#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <x86intrin.h>

#ifndef DEBUG
// #pragma GCC optimize("avx2")
// #pragma GCC optimize("O3")
#endif

using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
template<typename T>
using oset = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pll = std::pair<ll, ll>;

const ll MOD = 998244353;

std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());

std::vector<std::vector<ll>> dp, G;
std::vector<ll> is, sz;

void dfs(ll v) {
    sz[v] = 1;
    for (auto u : G[v]) {
        dfs(u);
        sz[v] += sz[u];
    }
}

void solve() {
    ll n, k;
    std::cin >> n >> k;
    G.resize(n);
    is.resize(n);
    sz.resize(n);
    std::vector<ll> d;
    ll ans = 1;
    for (int d = 1; d < n; ++d) {
        ans *= 2;
        ans %= MOD;
    }
    for (int i = 0; i < k; ++i) {
        ll x;
        std::cin >> x;
        --x;
        d.push_back(x);
        is[x] = 1;
    }
    for (int i = 1; i < n; ++i) {
        ll x;
        std::cin >> x;
        G[x - 1].push_back(i);
    }
    dfs(d[0]);
    ll dv = 1;
    for (auto u : G[d[0]]) {
        dv *= sz[u] + 1;
        dv %= MOD;
    }
    for (auto u : G[d[0]]) {
        dv -= sz[u];
        if (dv < 0) {
            dv += MOD;
        }
    }
    --dv;
    ans += dv;
    ans %= MOD;
    std::cout << ans;
}

int main() {
#ifdef DEBUG
    std::freopen("input.txt", "r", stdin);
#endif
    std::cin.tie(0)->std::ios::sync_with_stdio(0);
    int tt = 1;
    // std::cin >> tt;
    while (tt--) {
        solve();
    }
}
