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

#define int long long
// #pragma GCC optimize("O3, unroll-loops")
// #pragma GCC target("avx2")

// using namespace __gnu_pbds;
using ll = long long;
using namespace std;
//
// template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// template<class T> using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int MOD = 998244353;
int ans = 1;

void dfs(int v, int p,vector<int> &pw, vector<int> &sz, vector<int> &used, vector<vector<int>> &g) {
    sz[v] = 1;
    int sum = 0;
    for (auto u : g[v]) {
        if (u == p) {
            continue;
        }
        dfs(u, v, pw, sz, used, g);
        if (used[v]) {
            sum += sz[u];
        }
    }
    if (used[v]) {
        ans += pw[sum] - 1;
        ans = (ans % MOD + MOD) % MOD;
    }
    if (used[v]) {
        int sum = 0;
        for (auto u : g[v]) {
            if (u == p) {
                continue;
            }
            ans += sum * (((pw[sz[u]] - 1) % MOD + MOD) % MOD) % MOD;
            ans %= MOD;
            sum += (pw[sz[u]] - 1);
            sum = (sum % MOD + MOD) % MOD;
        }
    }
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> pw(n + 1, 0), sz(n, 0), used(n);
    vector<vector<int>> g(n);
    pw[0] = 1;
    for (int i = 1; i <= n; i++) {
        pw[i] = 2 * pw[i - 1];
        pw[i] %= MOD;
    }
    for (int i = 0; i < k; i++) {
        int x;
        cin >> x;
        x--;
        used[x] = 1;
    }
    for (int i = 1; i < n; i++) {
        int x;
        cin >> x;
        x--;
        g[x].push_back(i);
        g[i].push_back(x);
    }
    dfs(0, -1, pw, sz, used, g);
    cout << ans << "\n";
}

signed main() {
    int t = 1;
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    // cin >> t;
#else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#endif
    // cin >> t;
    while (t--) {
        solve();
    }
}