#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll INF = 1e15;
const ll mod = 998244353;

ll fast_pow (ll x, ll k){
    if (k == 0) return 1;
    if (k % 2 == 0){
        ll d = fast_pow(x, k/2);
        return d*d%mod;
    }
    else{
        ll d = fast_pow(x, k/2);
        return d*d%mod*x%mod;
    }
}

vector<vector<ll>> g;

set<ll> e;
vector<ll> sz;

ll ans = 0;


void dfs (ll u){
    sz[u] = 1;
    for (ll v : g[u]){
        dfs (v);
        sz[u] += sz[v];
    }
    if (e.count(u)){
        ans = fast_pow(2, sz[u]) - 1;
        for (ll v : g[u]){
            ans -= fast_pow(2, sz[v]) - 1;
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(false), cin.tie(0);
    ll n, k;
    cin >> n >> k;
    g.resize(n);
    sz.resize(n);
    for (int i = 0; i < k; ++i) {
        ll x;
        cin >> x;
        x--;
        e.insert(x);
    }
    for (int i = 1; i < n; ++i) {
        ll p;
        cin >> p;
        p--;
        g[p].push_back(i);
    }
    dfs (0);
    cout << ans;
}