#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
#define ll long long
using ll = long long;
using namespace std;
// #pragma GCC optimize("O3, unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
//  using ordered_set = tree<ll, null_type, less<ll>, rb_tree_tag,
//  tree_order_statistics_node_update>;
const ll mod = 998244353;  // dermo
ll modpow(ll a, ll x) {
    ll ret = 1ll;
    while (x) {
        if (x & 1ll) {
            ret *= a;
            ret %= mod;
        }
        a = (a * a) % mod;
        x >>= 1ll;
    }
    return ret;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, k;
    cin >> n >> k;
    vector<ll> x(k);
    for (auto& t : x) {
        cin >> t;
        t--;
    }
    vector<vector<ll>> g(n);
    for (ll i = 0; i < n - 1ll; i++) {
        ll p;
        cin >> p;
        p--;
        // g[i].push_back(p);
        g[p].push_back(i + 1ll);
    }
    vector<ll> dp(n, 1ll);
    vector<ll> sz(n, 1ll);
    auto dfs = [&](ll v, ll p, auto&& dfs) -> void {
        for (auto& to : g[v]) {
            dfs(to, v, dfs);
            sz[v] += sz[to];
        }
    };
    dfs(0, -1ll, dfs);
    ll ans = 0;
    ll prod = 1ll;
    ll sm = 0;
    for (auto& to : g[x[0]]) {
        prod *= (sz[to] + 1ll);
        prod = prod % mod;
        sm += sz[to];
    }

    ans += prod % mod;
    ans -= sm;
    ans = ans % mod;
    ans += modpow(2, sm);
    ans = ans % mod;
    cout << (ans - 1ll + 2 * mod) % mod << '\n';
    return 0;
}
