#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
using ll = long long;
ll mod = 998244353;
mt19937 rnd(52);
int ver = -1;
ll ans = 0;
vector<vector<int>> g;
ll binpow(ll a, ll p) {
    if (p == 0) {
        return 1;
    }
    if (p%2 == 0) {
        ll t = binpow(a, p/2);
        return t*t%mod;
    } else {
        return binpow(a, p-1)*a%mod;
    }
}
vector<int> used;
int dfs(int v) {
    //cout << v << endl;
    used[v] = 1;
    int si = 1;
    ll sum = 0;
    int k = 0;
    for (auto to:g[v]) {
        int x = dfs(to);
        si+=x;
        sum+=binpow(2, x);
        k++;
    }
    //cout << v << ' ' << si << ' ' << sum << ' ' << ver << endl;
    if (v == ver) {
        //cout << binpow(2, si) << endl;
        ans = binpow(2, si) - sum + k - 1;
        ans%=mod;
        ans+=mod;
        ans%=mod;
    }
    return si;
}
int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
#endif
    int n, k;
    cin >> n >> k;
    vector<int> x;
    for (int i = 0; i < k; i++) {
        int xx;
        cin >> xx;
        x.push_back(xx);
    }
    vector<int> p(n-1);
    g.resize(n);
    used.resize(n);
    for (int i = 0; i < n-1; i++) {
        cin >> p[i];
        g[p[i]-1].push_back(i+1);
    }
    ver = x[0]-1;
    for (int i = 0; i < n; i++) {
        if (!used[i]) {
            dfs(i);
        }
    }
    cout << ans << '\n';
    return 0;
}