#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = __uint128_t;
using uc = __uint128_t;
using ull =__uint128_t;
using ul = __uint128_t;
using i128 = __int128_t;
using u128 = __uint128_t;

ll MOD = 998244353LL;
ull P1 = 7692758373ULL;
ull P2 = 8694758251ULL;
ull MD1 = 8769375815ULL;
ull MD2 = 976947525ULL;

inline ll binpow(ll a, ll e) {
    ll res = 1;

    while (e) {
        if (e & 1) res = res * a % MOD;
        a = a * a % MOD;
        e >>= 1;
    }

    return res;
}


inline void solve(ostringstream& os) {
    int n, k;
    cin >> n >> k;
    vector<int> floors(k, 0);
    for (int i = 0; i < k; ++i) {
        cin >> floors[i];
        floors[i]--;
    }

    vector<vector<int>> g(n);
    for (int i = 1; i < n; i++) {
        int to;
        cin >> to;

        g[to - 1].push_back(i);
    }


    auto dfs = [&](auto&& self, int current) -> ll {
        ll sum = 1;

        for (int next : g[current]) {
            sum += self(self, next);
        }

        return sum;
    };
    vector<ll> children;
    int src = floors[0];
    for (int next : g[src]) {
        children.push_back(dfs(dfs, next));
    }
    ll total = 0;
    for (ll ch : children) total += ch;

    ll res = (2 * binpow(2LL, total)) % MOD;
    for (ll ch : children) {
        res -= binpow(2LL, ch) - 1;
        if (res < 0) res += MOD;
    }


    os << res - 1;
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ostringstream os;

    solve(os);

    cout << os.str();
    // exit(0);
}