#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e6 + 3, mod = 998244353;
vector<int> g[N];
int pw[N];
bool x[N];
//int dp[N][N];
//int cur[2][N][N];
int nxt[2][N], sz[N];
int fact[N];
int ans = 0;
int fast_pow(int x, int st){
    if (st == 1){
        return x;
    }
    int t = fast_pow(x, st / 2);
    t = (t * t) % mod;
    if (st % 2){
    t = (t * x) % mod;
    }
    return t;
}
int C(int n, int k){
    int res = fact[n] * fast_pow(fact[k], mod - 2) % mod;
    return res * fast_pow(fact[n - k], mod - 2) % mod;
}
void dfs(int v){
    /*if (x[v]){
        cur[1][v][0] = 1;
    }
    cur[0][v][0] = 1;
    cur[0][v][1] = 1;
    sz[v] = 1;
    for (auto to : g[v]){
        dfs(to);
        for (int c1 = 0; c1 <= sz[to]; c1++){
            for (int c = 0; c <= sz[v]; c++){
                if (x[v]){
                    for (int use = 0; use <= c1; use++){
                        nxt[1][c + c1 - use] += cur[1][v][c] * dp[to][c1] % mod * C(c1, use) % mod;
                        nxt[1][c + c1 - use] %= mod;
                        if (use != 0){
                            nxt[0][c1 + c - use] += cur[0][v][c] * dp[to][c1] % mod * C(c1, use) % mod;
                            nxt[0][c1 + c - use] %= mod;
                        }
                    }

                } else {
                    nxt[0][c + c1] += dp[to][c1] * cur[0][v][c] % mod;
                    nxt[0][c + c1] %= mod;
                    nxt[1][c + c1] += dp[to][c1] * cur[1][v][c] % mod;
                    nxt[1][c + c1] %= mod;
                }
            }
        }
        sz[v] += sz[to];
        for (int c = 0; c<=sz[v]; c++){
            cur[0][v][c] = nxt[0][c];
            cur[1][v][c] = nxt[1][c];
            nxt[0][c] = 0;
            nxt[1][c] = 0;
        }
    }
    for (int c = 0; c <= sz[v]; c++){
        if (!x[v]){
            dp[v][c] = cur[0][v][c];
        } else {
            if (g[v].size() == 1){
                dp[v][c] = cur[1][v][c];
            } else {
                dp[v][c] = (cur[0][v][c] + cur[1][v][c]) % mod;
            }
        }
        //cout << v + 1 << " " << c << " " << cur[0][v][c] << " " << cur[1][v][c] << " " << dp[v][c] << "\n";
        //dp[v][c] = cur[0][v][c] + cur[1][v][c];
    }*/
    sz[v] = 1;
    for (auto to : g[v]){
        dfs(to);
            sz[v] += sz[to];

    }
    int res1 = 1, res2 = 1;
    if (x[v]){
        for (auto to : g[v]){
            res1 = res1 * fast_pow(2, sz[to]) % mod;
            res2 = res2 * ((fast_pow(2, sz[to]) - 1 + mod) % mod) % mod;
        }
        ans = res1;
        if (g[v].size() >= 2){
            ans += (res2);
            ans %= mod;
        }
    }
}
signed  main(){
     ios::sync_with_stdio(false);
     cin.tie(nullptr);
     fact[0] = 1;
     for (int i = 1; i < N; i++){
        fact[i] = fact[i - 1] * i % mod;
     }
     int n, k;
     cin >> n >> k;
     for (int i = 0; i < k; i++){
        int j;
        cin >> j;
        j--;
        x[j] = true;
     }
     for (int i = 1; i < n; i++){
        int p;
        cin >> p;
        p--;
        g[p].push_back(i);
     }
     dfs(0);
     cout << ans;
     //cout << dp[0][0];
 }
