//задача от Саши Бабина?
#include <bits/stdc++.h>

using namespace std;

#define int long long
const int mod = 998244353;

int binpow(int a, int x) {
    int res = 1;
    while (x) {
        if (x & 1) {
            res *= a;
            res %= mod;
        }
        a *= a;
        a %= mod;
        x >>= 1;
    }
    return res;
}

int ans = 0;

void cacl(int v, vector<vector<int>>&gr, vector<int>&term, vector<int>&sz) {
    sz[v] = 1;
    for (auto i: gr[v]) {
        cacl(i, gr, term, sz);
        sz[v] += sz[i];
    }
    ans = mod + binpow(2, sz[v]) - 1;
    ans %= mod;
    if (term[v]) {
        for (auto i: gr[v]) {
            ans %= mod;
            ans += mod;
            ans -= (binpow(2, sz[i])) - 1;
            ans %= mod;
        }
        ans %= mod;
    }
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<vector<int>>gr(n);
    int p;
    vector<int>x(k);
    vector<int>term(n);
    for (int i = 0; i < k; i++) {
        cin >> x[i];
        term[x[i] - 1] = 1;
    }
    for (int i = 1; i < n; i++) {
        cin >> p;
        gr[p - 1].push_back(i);
    }
    vector<int>sz(n);
    cacl(0, gr, term, sz);
    cout << ans << endl;
}

signed main() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    solve();
}
