#pragma GCC optimize("O3,unroll-loops")
#include <string>
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>

using namespace std;

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

const ll mod = 998244353;

ll fpow (ll a, ll n) {
    ll ans = 1;
    while (n > 0) {
        if (n % 2 == 1) {
            ans = (ans * a) % mod;
            --n;
        }
        a = (a * a) % mod;
        n /= 2;
    }
    return ans;
}

vector<vector<int>>graph;
vector<int>sz;

void Dfs (int u) {
    sz[u] = 1;
    for (int v : graph[u]) {
        Dfs(v);
        sz[u] += sz[v];
    }
}

void Solve () {
    int n, k;
    cin >> n >> k;
    vector<int>x(k);
    for (int i = 0; i < k; ++i) {
        cin >> x[i];
        --x[i];
    }
    graph.resize(n);
    for (int i = 1; i < n; ++i) {
        int pi;
        cin >> pi;
        --pi;
        graph[pi].push_back(i);
    }
    sz.resize(n);
    Dfs(0);
    ll ans = fpow(2, sz[x[0]]) - 1;
    vector<ll>a;
    for (int v : graph[x[0]]) {
        ans = ((ans - fpow(2, sz[v]) + 1) + mod) % mod;
    }
    cout << ans;
}

signed main () {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        Solve();
    }
}