#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
const int INF = 998244353;

int pw(int x, int y) {
    if (y == 0) return 1;
    int h = pw(x, y / 2) % INF;
    if (y % 2 == 0) return (h * h) % INF;
    return (((h * h) % INF) * x) % INF;
}

vector<vector<int>> g;
vector<int> sz;

void dfs(int v, int p) {
    sz[v] = 1;
    for (auto u:g[v]) {
        if (u == p) continue;
        dfs(u, v);
        sz[v] += sz[u];
    }
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> x(k);
    g.resize(n);
    sz.resize(n);
    for (int i = 0; i < k; ++i) cin >> x[i];
    vector<int> p(k);
    for (int i = 1; i < n; ++i) {
        cin >> p[i];
        p[i]--;
        g[i].push_back(p[i]);
        g[p[i]].push_back(i);
    }
    dfs(0, -1);
    x[0]--;
    //for (auto i:sz) cout << i << ' ';
    //cout << endl;
    int ans = pw(2, sz[x[0]]);
    int v = x[0];
    for (auto u:g[v]) {
        if (u == p[v]) continue;
        ans -= (pw(2, sz[u]) - 1);
        ans %= INF;
    }
    ans -= 1;
    ans %= INF;
    cout << ans << '\n';

}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t = 1;
    while (t--) solve();
}
