#include <bits/stdc++.h>

using namespace std;

#define f(i, n) for(int i=0;i<n;i++)
#define f1(i, n) for(int i=1;i<n;i++)
#define ll long long
#define MOD (ll)998244353
#define int ll
#define vi vector<int>
#define vvi vector<vi>

int add(int a, int b)
{
    return (a+b) % MOD;
}

int sub(int a, int b)
{
    return ((a-b) % MOD + MOD) % MOD;
}

int mul(ll a, ll b)
{
    return (a*b) % MOD;
}

int mpw(int a, int n)
{
    int res = 1;
    for (; n > 0; a=mul(a,a), n >>= 1)
        if (n & 1)
            res = mul(res, a);
    return res;
    // int res = 1;
    // f(i, n)
    //     res = mul(res, a);
    // return res;
}
int n, k;
vi xs;
vi ter;
vi p;
vvi ch;
vi anh;

int an(int v)
{
    if (anh[v] != -1)
        return anh[v];
    int res = 2;
    for (int u : ch[v])
        res = mul(res, an(u));
    // return res;
    return anh[v] = res;
}

int one(int v)
{
    // int res = 1;
    // for (int u : ch[v])
    //     res = mul(res, an(u));
    return an(v) - 1;
}

int dfs(int v)
{
    int res = 0;
    int th = 1;
    vi ans(ch[v].size());
    f(i, ch[v].size())
    {
        ans[i] = an(ch[v][i]);
    }
    // for (int u : ch[v])
    // {
    //     th = mul(th, an(u));
    // }
    f(i, ch[v].size())
        th = mul(th, ans[i]);
    res = add(res, th);
    int noth = sub(th, 1);
    f(i, ch[v].size())
        noth = sub(noth, one(ch[v][i]));
    res = add(res, noth);
    return res;
}

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

    cin >> n >> k;
    xs = vi(k);
    ter = vi(n);
    f(i, k)
    {
        cin >> xs[i];
        xs[i]--;
        ter[xs[i]] = 1;
    }
    p = vi(n);
    p[0] = -1;
    ch = vvi(n);
    f1(i, n)
    {
        cin >> p[i];
        p[i]--;
        ch[p[i]].push_back(i);
    }
    
    anh = vi(n, -1);
    cout << dfs(xs[0]) << '\n';
    return 0;
}