#include<algorithm>
#include <iostream>
#include<set>
#include<map>
#include<unordered_map>
#include<math.h>
#include<cmath>
#include<vector>
#include<queue>
#include<deque>
#include<iomanip>
#include<random>

using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")

using ll = long long;
using ld = long double;
#define all(x) x.begin(), x.end()

ll inf = 1e18, mod = 998244353, ans;

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

vector<ll> sz, u;
vector<vector<ll>> g;

void dfs(ll d) {
    sz[d] = 1;
    for (ll a : g[d]) {
        dfs(a);
        sz[d] += sz[a];
        if (u[d]) ans = (ans - binpow(2, sz[a]) + mod) % mod;
    }
    if (u[d]) ans = (ans + binpow(2, sz[d])) % mod;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n, k, x;
    cin >> n >> k;
    ans = n;
    u.resize(n);
    sz.resize(n);
    g.resize(n);
    for (int i = 0; i < k; ++i) {
        cin >> x;
        u[x] = 1;
    }
    for (int i = 1; i < n; ++i) {
        cin >> x;
        g[x - 1].push_back(i);
    }
    dfs(0);
    cout << ans;
}

