#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
using ll = long long;
vector<int> p;
vector<vector<int>> tr;
const int maxn = 1e6 + 10;
int sz[maxn];
const ll mod = 998244353;
bool marked[maxn];
ll sd[maxn];
ll res = 1;
void calc(int v)
{
    sz[v] = 1;
    vector<int> szes;
    for (int i : tr[v])
    {
        calc(i);
        sz[v] += sz[i];
        szes.push_back((sz[i]));
    }
    if (marked[v]) {
        ll mres = 0;
        mres = (mres + sd[sz[v] - 1])%mod;
        ll prop = 1;
        ll decr = 0;
        for (int f : szes) {
            prop = (prop * sd[f]) % mod;
            decr = (decr + f * sd[f-1])%mod;
        }
        mres = (mres + prop)%mod;
        mres = (mres - decr + mod)%mod;
        mres = (mres + mod - 1)%mod;
        res = (res * mres) % mod;

    }
}
signed main()
{
#ifdef LOCAL
    freopen("main.in", "r", stdin);
    freopen("main.out", "w", stdout);
#endif
    int n, k;
    cin >> n >> k;
    sd[0] = 1;
    for (int i = 1; i < maxn; ++i)
    {
        sd[i] = sd[i - 1] * 2 % mod;
    }
    tr.resize(n);
    p.resize(n);
    for (int i = 0; i < k; ++i)
    {
        int q;
        cin >> q;
        marked[q-1] = 1;
    }
    for (int i = 1; i < n; ++i)
    {
        int a;
        cin >> a;
        --a;
        p[i] = a;
        tr[a].push_back(i);
    }

    calc(0);
    cout << res << "\n";
}