//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define int long long

const int mod = 998244353;
vector<vector<int>> g;
vector<int> arr, sz;
int ans = 0;
int ans1 = 1;

int bp(int x, int k) {
    if (k == 0) return 1ll;
    if (k % 2 == 0) return bp(x * x % mod, k / 2);
    return x * bp(x, k - 1) % mod;
}

void dfs(int v) {
    for (auto i: g[v]) {
        dfs(i);
        if (arr[v] == 1) ans1 = ans1 * bp(2, sz[i]) % mod;
    }
    if (arr[v] == 0) {
        for (auto i: g[v]) sz[v] += sz[i];
        return;
    }
    int gh = (ans1 * 2 + mod - 1) % mod;
    for (auto i: g[v]) {
        gh = (gh + mod - bp(2, sz[i]) + 1) % mod;
    }
    ans = gh;
    for (auto i: g[v]) sz[v] += sz[i];
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> a(k);
    for (int i = 0; i < k; i++) cin >> a[i];
    arr = vector<int>(n, 0);
    for (int i = 0; i < k; i++) arr[a[i] - 1] = 1;
    g = vector<vector<int>>(n);
    for (int i = 0; i < n - 1; i++) {
        int x;
        cin >> x;
        g[x - 1].push_back(i + 1);
    }
    sz = vector<int>(n, 1);
    dfs(0);
    cout << ans % mod;
}

signed main() {
//    freopen("input.txt", "rb", stdin);
//    freopen("output.txt", "wb", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
//    cin >> t;
    while (t--) solve();
}
