#include "bits/stdc++.h"

#pragma GCC optimize("03,unroll-loops")

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define len(x) ((int)x.size())

using namespace std;
using ll = long long;
using ld = long double;

const int mod = 998244353;

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

int ml(int a, int b) {
    return 1LL * a * b % mod;
}

int sub(int a, int b) {
    return a - b + (a - b < 0 ? mod : 0);
}

int sp(int a, int n) {
    int ans = 1;
    for (int t = a; n; n /= 2, t = ml(t, t)) {
        if (n & 1) ans = ml(ans, t);
    }
    return ans;
}

vector<vector<int>> gr, dp;
vector<int> x, sz, use;

void go(int u) {
    sz[u] = 1;
    for (auto to : gr[u]) {
        go(to);
        sz[u] += sz[to];
    }
}

void dfs(int u) {
    if (!len(gr[u])) {
        if (use[u]) {
            dp[u][1] = 1;
        } else {
            dp[u][0] = dp[u][1] = 1;
        }
        return;
    }
    for (auto to : gr[u]) {
        dfs(to);
    }
    if (use[u]) {
        for (int cnt = 1; cnt <= sz[u]; ++cnt) {
            dp[u][cnt] = sum(dp[u][cnt], sp(2, cnt - 1));

        }
    } else {
        dp[u][0] = 1;
    }
}

void solve() {
    int n, k;
    cin >> n >> k;
    x.resize(k);
    gr.resize(n);
    sz.resize(n);
    use.resize(n);
    for (auto &h : x) {
        cin >> h;
        --h;
        use[h] = 1;
    }
    for (int i = 1; i < n; ++i) {
        int p;
        cin >> p;
        --p;
        gr[p].push_back(i);
        // gr[i].push_back(p);
    }
    go(0);
    dp.resize(n, vector<int> (n + 1));
    int cn = 0;
    for (int u = n - 1; u >= 0; --u) {
        if (use[u]) {
            if (u + 1 < n) {
                for (int cnt = max(1, cn); cnt <= n; ++cnt) {
                    dp[u][cnt] = dp[u + 1][cnt - 1];
                    // if (!dp[u][cnt]) break;
                }
            } else {
                dp[u][1] = 1;
            }
            ++cn;
        } else {
            if (!cn) {
                dp[u][0] = 1;
            }
            if (u + 1 < n) {
                for (int cnt = max(1, cn + 1); cnt <= n; ++cnt) {
                    dp[u][cnt] = sum(dp[u + 1][cnt], dp[u + 1][cnt - 1]);
                    // if (!dp[u][cnt]) break;
                }
            } else {
                if (!cn) {
                    dp[u][1] = 1;
                }
            }
        }
        cerr << u + 1 << ": ";
        for (auto h : dp[u]) cerr << h << ' ';
        cerr << endl;
    }
    // for (int i = 0; i < n; ++i) {
    //     dp[i].resize(sz[i] + 1);
    // }
    // dfs(0);
    int ans = 0;
    for (int cnt = k; cnt <= n; ++cnt) {
        ans = sum(ans, dp[0][cnt]);
    }
    cout << ans;

    // int ans = sp(2, sz[x[0]] - 1);
    // ans = sum(ans, sub(sp(2, sz[x[0]] - 1), 1));
    // for (auto to : gr[x[0]]) {
    //     ans = sub(ans, sub(sp(2, sz[to]), 1));
    // }
    // cout << ans;
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int _ = 1;
    // cin >> _;
    while (_--) {
        solve();
        cout << '\n';
    }
}
