#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define cin(x) for (auto &i : (x)) cin >> i;
#define cout(x) for (auto &i : (x)) cout << i << " "; cout << "\n"
#define fori(x) for (int i = 0; i<(x); i++)
#define forj(x) for (int j = 0; j<(x); j++)
#define fork(x) for (int k = 0; k<(x); k++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(), (x).rend()

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int N = 1e6;
vector<vector<int> > g(N);
vector<int> sz(N), tin(N), tout(N);
int ti = 0;

void dfs(int v) {
    sz[v] = 1;
    tin[v] = ti++;
    for (auto u: g[v]) {
        dfs(u);
        sz[v] += sz[u];
    }
    tout[v] = ti;
}

const int mod = 998244353;

int mul(int a, int b) {
    return 1ll * a * b % mod;
}

int sum(int a, int b) {
    a += b;
    if (a >= mod) a -= mod;
    return a;
}

int pa(int v, int u) {
    return (tin[v] <= tin[u]) && (tout[v] >= tout[u]);
}

void solve() {
    vector<int> pw(N + 10);
    pw[0] = 1;
    for (int i = 1; i < N + 10; i++) pw[i] = mul(pw[i - 1], 2);
    /////
    int n, k;
    cin >> n >> k;
    vector<int> x(k);
    cin(x);
    fori(n-1) {
        int p;
        cin >> p;
        p--;
        g[p].push_back(i + 1);
    }
    dfs(0);
    int ans = 0;
    fori(n) {
        if (pa(i, x[0])) {
            ans = sum(ans, pw[sz[i] - 1]);
        }
    }
    cout << ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt = 1;
    // cin >> tt;
    while (tt--) {
        solve();
    }
    return 0;
}
