#include <bits/stdc++.h>

#define int long long
// #pragma GCC optimize("O3")
// // #pragma GCC optimize("Ofast")
// // #pragma GCC target("unroll_loops")

using ll = long long;
using ld = long double;
using namespace std;

// #include <ext/pb_ds/assoc_container.hpp>

//  using namespace __gnu_pbds;
// using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

const int INF = 1e18, MAXN = 1e5, mod = 998244353;

int binpow(int a, int b) {
    if (b == 0) {
        return 1;
    }
    int aa = binpow(a, b / 2);
    if (b % 2 == 0) {
        return (aa * aa) % mod;
    }
    return ((aa * aa) % mod * a) % mod;
}

void solve();

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int tt = 1;
    //cin >> tt;
    while (tt--) {
        solve();
        cout << "\n";
    }
}

int n, k, ans = 0;
vector<vector<int> > g;
vector<int> cnt, tt, used;

void dfs(int u, int p) {
    used[u] = 1;
    for (auto v: g[u]) {
        if (used[v] == 0) {
            dfs(v, u);
            cnt[u] += cnt[v];
        }
    }
    if (tt[u] == 0) {
        return;
    }
    int all = 0;
    for (auto v: g[u]) {
        if (v == p) {
            continue;
        }
        all += cnt[v];
    }
    ans += binpow(2, all);
    all -= 2;
    int all1 = 0;
    if (all >= 0) {
        for (auto v: g[u]) {
            if (v == p) {
                continue;
            }
            ans += (binpow(2, all) * (cnt[v] * all1) % mod) % mod;
            ans %= mod;
            all1 += cnt[v];
        }
    }
}

void solve() {
    cin >> n >> k;
    g.resize(n);
    used.resize(n);
    cnt.resize(n, 1);
    tt.resize(n);

    for (int i = 0; i < k; i++) {
        int u;
        cin >> u;
        u--;
        tt[u] = 1;
    }

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

    dfs(0, 0);
    cout << ans;
}
