#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;
vector<int> x, sz;

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

void solve() {
    int n, k;
    cin >> n >> k;
    x.resize(k);
    gr.resize(n);
    sz.resize(n);
    for (auto &h : x) {
        cin >> h;
        --h;
    }
    for (int i = 1; i < n; ++i) {
        int p;
        cin >> p;
        --p;
        gr[p].push_back(i);
        // gr[i].push_back(p);
    }
    dfs(0);
    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';
    }
}
