#include <bits/stdc++.h>

#define all(v) v.begin(), v.end()
#define len(v) (int)v.size()

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

const ll Mod = 998'244'353;
vector<vector<int>> g;
vector<int> isx;
vector<vector<ll>> dp;
vector<ll> pow2;
vector<ll> cntd;
ll ans;

void dfs(int v)
{
    cntd[v] = 1;
    vector<ll> ch;
    for (int u : g[v])
    {
        dfs(u);
        cntd[v] += cntd[u];
        ch.push_back(cntd[u]);
    }
    ll s = cntd[v] - 1;
    if (isx[v])
    {
        ll cur = 0;
        cur = ((pow2[s] + pow2[s] - 1)) % Mod;
        for (ll x : ch)
        {
            cur = (cur - pow2[x] + 1 + Mod) % Mod;
        }
        ans = (ans * cur) % Mod;
    }
}

void solve()
{
    int n, k;
    cin >> n >> k;
    ans = 1;
    g.assign(n, {});
    isx.assign(n, 0);
    cntd.assign(n, 0);
    dp.assign(2, vector<ll>(n, 0));
    pow2.assign(n + 1, 1);
    for (int i = 1; i <= n; ++i)
    {
        pow2[i] = (pow2[i - 1] * 2) % Mod;
    }
    vector<int> x(k);
    for (int i = 0; i < k; ++i)
    {
        cin >> x[i];
        --x[i];
        isx[x[i]] = 1;
    }
    for (int i = 1; i < n; ++i)
    {
        int p;
        cin >> p;
        --p;
        g[p].push_back(i);
    }
    dfs(0);
    cout << ans;
    //cout << (dp[0] + dp[1]) % Mod;
}

int main()
{
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);

    //cin >> t;

    while (t--)
    {
        solve();
        cout << '\n';
    }
    return 0;
}
