#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 int long long
#define db double
#define ll long long
#define pii pair<int, int>
#define tiii tuple<int ,int, int >
#define tiiii tuple<int, int, int, int>
#define tiiiii tuple<int, int, int, int, int>
#define ve vector
#define vi ve<int>
#define vvi ve<vi>
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
#define cin(a) for(auto &now : a) cin >> now;
#define print(a, s) for(auto now : a) cout << now << s;
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rnd(time(0));
const int N = 1e6 + 10;
const int M = 998244353;
int st(int a, int n) {
    if (n == 0) return 1;
    return (n % 2 == 0 ? st(a * a % M, n / 2) : a * st(a, n - 1) % M);
}
vi g[N];
int sz[N];
void dfs(int v, int par) {
    sz[v] = 1;
    for (auto u : g[v]) {
        dfs(u, v); sz[v] += sz[u];
    }
}
void solve() {
    int n, k; cin >> n >> k;
    vi x(k); cin(x);
    for (int i= 0 ;  i < k; ++i) --x[i];
    for (int i = 1; i < n; ++i) {
        int p; cin >> p; --p; g[p].push_back(i);
    }
    dfs(0, 0);
    int ans = st(2, sz[x[0]]) - 1;
    for (auto u : g[x[0]]) ans -= st(2, sz[u]) - 1;
    cout << (ans % M + M) % M;
    // x.push_back(-1);
    // sort(all(x));
    // int ans = 1;
    // for (int i = 1; i < k; ++i) {
    //     ans += (st(2, x[i] - x[i - 1]) - 1);
    // }
    // cout << ans;

}
int32_t main() {
    // ios::sync_with_stdio(0);
    // cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(9);

    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}


