#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;

using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;
using ll = long long;

constexpr ll mod = 998244353;

ll binpow(ll x, ll p) {
    if (p == 0) return 1;
    if (p == 1) return x;
    if (p % 2 == 1) {
        return (x * binpow(x, p - 1)) % mod;
    }
    ll k = binpow(x, p / 2);
    return (k * k) % mod;
}

vector<vector<ll>> g;
vector<ll> sz;

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

void solve() {
    ll n, k;
    cin >> n >> k;
    vector<ll> x(k);
    for (ll &i : x) cin >> i;
    vector<ll> p(n);
    p[0] = -1;
    for (ll i = 1; i < n; i++) {
        cin >> p[i];
        p[i]--;
    }
    ll root = x[0] - 1;
    g.resize(n);
    for (ll i = 1; i < n; i++) {
        g[p[i]].push_back(i);
    }
    sz.resize(n, 0);
    dfs(0);
    ll z = sz[root];
    ll ans = 1;
    for (ll i : g[root]) {
        z -= sz[i];
        ans += (binpow(2, sz[i]) - 1) * (binpow(2, z) - 1);
    }
    cout << ans;
}

signed main() {
    // #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    // #endif
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    ll t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}