#include <iostream>
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using lll = __int128;
using pii = pair <int, int>;
template <typename T>
using vec = vector <T>;

#define all(x) x.begin(), x.end()

template <typename T>
istream& operator >>(istream& in, vec <T>& a) {
    for (auto& x : a) in >> x;
    return in;
}
template <typename T>
ostream& operator <<(ostream& in, vec <T>& a) {
    for (T x : a) in << x << " ";
    return in;
}
template <typename T, typename Y>
istream& operator >>(istream& in, pair <T, Y>& a) {
    in >> a.first >> a.second;
    return in;
}
template <typename T, typename Y>
ostream& operator <<(ostream& in, pair <T, Y>& a) {
    in << a.first << " " << a.second;
    return in;
}
void FAST() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

const int INF = 1e9 + 7;
const ll LLINF = 1e18 + 7;
const ll MOD = 998'244'353;

ll binpow(ll val, ll st) {
    if (st == 0) return 1;
    ll a = binpow(val, st / 2);
    a = (a * a) % MOD;
    if (st % 2) a = (a * val) % MOD;
    return a;
}

void count_cnt(int v, vec <vec <int>>& g, vec <int>& sz) {
    sz[v] = 1;
    for (int x : g[v]) {
        count_cnt(x, g, sz);
        sz[v] += sz[x];
    }
}

int main() {
    FAST();

    int n, k;
    cin >> n >> k;
    vec <int> X(k);
    cin >> X;
    for (int& x : X) x--;

    vec <vec <int>> g(n);
    for (int i = 1, p; i < n; i++) {
        cin >> p;
        p--;
        g[p].push_back(i);
    }

    vec <int> sz(n);
    count_cnt(0, g, sz);

    int v = X[0];
    if (g[v].empty()) cout << 1;
    else if (g[v].size() == 1) {
        cout << (binpow(2, sz[X[0]] - 1) - sz[X[0]] + 1 + MOD) % MOD;
    }
    else {
        ll ans = binpow(2, sz[X[0]] - 1);
        ll sm = ans;
        for (int x : g[v]) {
            sm = (sm + MOD - binpow(2, sz[x])) % MOD;
        }
        ans = (ans + sm + 1) % MOD;
        cout << ans;
    }
}