//#define _GLIBCXX_DEBUG
#pragma GCC optimize("O3", "unroll-loops")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
const ll mod = 998244353;

ll bp(ll a, ll b) {
    if (b == 0) return 1;
    ll ans = 1;
    if (b % 2) ans = a;
    ll tp = bp(a, b / 2);
    ans = ans * tp % mod * tp % mod;
    return ans;
}

/*void solve() {
    ll n, q;
    cin >> n >> q;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
    }

}*/

vector<vector<ll>> g;
vector<ll> tin, tout, sz;
ll timer = 1;

void calc(ll v, ll p) {
    sz[v] = 1;
    for (auto u : g[v]) {
        if (u != p) {
            calc(u, v);
            sz[v] += sz[u];
        }
    }
}

void solve() {
    ll n,k;
    cin >> n >> k;
    assert(k == 1);
    vector<ll> x(n);
    for (ll i = 0; i < k; i++) {
        cin >> x[i];
        x[i]--;
    }
    g.resize(n), tin.resize(n), tout.resize(n), sz.resize(n);
    vector<ll> par(n);
    for (ll i = 1; i < n; i++) {
        ll p;
        cin >> p;
        --p;
        par[i] = p;
        g[p].push_back(i);
        g[i].push_back(p);
    }
    calc(0, -1);
    ll ans = bp(2, sz[x[0]]);
    for (auto u : g[x[0]]) {
        if (u == par[x[0]]) continue;
        ans -= bp(2, sz[u]) - 1;
        ans %= mod;
    }
    ans--;
    cout << (ans % mod + mod) % mod;
}

void solveC() {
    ll n, k;
    cin >> n >> k;
    vector<int> prec;
    vector<ll> x(n);
    for (ll i = 0; i < k; i++) {
        cin >> x[i];
        x[i]--;
    }
    vector<ll> cnts;
    for (ll i = 1; i < k; i++) {
        cnts.push_back(x[i] - x[i - 1]);
    }
    cnts.push_back(n - x.back());
    ll cur = 1;
    for (auto i : cnts) {
        
    }
}


void solveA() {
    ll n,q;
    cin >> n >> q;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }
    vector<int> pos(n + 1);
    {
        vector<vector<ll>> g(n);
        for (ll i = 0; i < n; i++) {
            g[a[i]].push_back(i);
        }
        for (auto& i : g) {
            reverse(i.begin(), i.end());
        }
        set<pair<ll, ll>> st;
        for (ll i = 0; i < n; i++) {
            if (!g[a[i]].empty()) {
                st.insert({g[a[i]].back(), a[i]});
            }
        }
        ll op = 0, prev = -1;
        for (ll i = 0; i < n; i++) {
            auto mn = st.begin();
            if (mn->second == prev && next(mn) != st.end()) {
                mn++;
            }
            op++;
            prev = mn->second;
            pos[mn->first] = op;
            g[mn->second].pop_back();
            if (!g[mn->second].empty()) {
                st.insert({g[mn->second].back(), mn->second});
            }
            st.erase(mn);
        }
    }
    while (q--) {
        ll type;
        cin >> type;
        if (type == 1) {
            ll x;
            cin >> x;
            --x;
            //if (a[x] == a[x + 1]) continue;
            swap(a[x], a[x+1]);
            swap(pos[x], pos[x + 1]);
        }
        else {
            int idx;
            cin >> idx;
            --idx;
            cout << pos[idx] << "\n";
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
}