#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

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

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin >> t;
    while (t--) solve();
}

#define int ll

int mod = 998244353;

struct Mint {
    int x;

    Mint() :x(0) {}
    Mint(int x) : x(x) {}
};

Mint operator+(Mint a, Mint b) {
    int c = a.x + b.x;
    return c < mod ? c : c - mod;
}

Mint operator-(Mint a, Mint b) {
    int c = a.x - b.x;
    return c < 0 ? c + mod : c;
}

Mint operator*(Mint a, Mint b) {
    return a.x * b.x % mod;
}

Mint powm(Mint a, int n) {
    if (n == 0) return 1;
    Mint t = powm(a, n >> 1);
    t = t * t;
    return n & 1 ? t * a : t;
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<vector<int>> g(n);
    vector<int> t(k);
    for (auto& x : t) {
        cin >> x; --x;
    }
    for (int i = 0; i < n - 1; ++i) {
        int p;
        cin >> p; --p;
        g[p].push_back(i + 1);
    }
    vector<Mint> dp(n, 1), sz(n, 1);
    function<void(int)> dfs = [&] (int v) {
        for (auto u : g[v]) {
            dfs(u);
            sz[v] = sz[v] + sz[u];
        }
        Mint s = 0;
        for (auto u : g[v]) {
            s = s + sz[u];
            dp[v] = dp[v] + (powm(2, sz[u].x) - 1) * (powm(2, (sz[v] - s).x) - 1);
        }
    };
    dfs(0);
    Mint ans = 1;
    for (auto v : t) ans = ans * dp[v];
    cout << ans.x << '\n';
}