// template.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #define int long long

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

const int MOD = 998244353;

int modpow(int a, int b)
{
    if (b == 0)
        return 1;
    if (b & 1)
        return 1ll * a * modpow(a, b - 1) % MOD;
    return modpow(1ll * a * a % MOD, b >> 1);
}

const int MAXN = 1e6 + 10;
vector <int> g[MAXN];
int sz[MAXN];
bool used[MAXN];

ll ans = 1;

void dfs(int v)
{
    sz[v] = 1;
    for (auto& i : g[v])
    {
        dfs(i);
        sz[v] += sz[i];
    }
    if (used[v])
    {
        ll good = modpow(2, sz[v]) - 1ll;
        for (auto& i : g[v])
        {
            good -= modpow(2, sz[i]) - 1ll;
        }
        ans *= good;
        ans %= MOD;
    }
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vector <int> x(k);
    for (auto& i : x)
    {
        cin >> i; i--;
    }
    for (size_t i = 1; i < n; i++)
    {
        int pi;
        cin >> pi;
        pi--;
        g[pi].push_back(i);
    }
    for (auto& i : x)
    {
        used[i] = true;
    }
    dfs(0);
    if (ans < 0)
        ans += MOD;
    cout << ans << '\n';
    return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
