#include <bits/stdc++.h>

using namespace std;

const int64_t mod = 998244353;
int64_t ans = 0;

int64_t bin_pow(int64_t a,int64_t n) {
    if(n == 0) {
        return 1;
    }
    int64_t x = bin_pow(a,n/2);
    int64_t y = (x * x) % mod;
    if(n % 2) {
        y = (y * a) % mod;
    }
    return y;
}

void dfs(int v, int p, vector<vector<int>> &g, vector<int> &sz, vector<int> & dp, vector<int> &x) {    
    vector<int64_t> cur;    
    sz[v] = 1;
    for(auto u : g[v]) {
        if(u != p) {
            dfs(u, v, g, sz, dp, x);
            sz[v] += sz[u];
            cur.emplace_back(sz[u]);
        }
    }
    if(x[v]) {
        int64_t res = 2;
        for(auto u : cur) {
            res = (res * (bin_pow(2, u))) % mod;
        }
        res = (res - 1 + mod) % mod;
        for(auto u : cur) {
            res = (res - (bin_pow(2, u) - 1) + mod) % mod;
        }
        ans = res;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    int n,k;
    cin >> n >> k;
    vector<int> x(n);
    for(int i = 0; i < k; ++i) {
        int cur;
        cin >> cur;
        cur--;
        x[cur] = 1;
    }
    vector<vector<int>> g(n);
    for(int i = 1; i < n; ++i) {
        int v;
        cin >> v;
        v--;
        g[v].emplace_back(i);
        g[i].emplace_back(v);
    }    
    vector<int> sz(n);
    vector<int> dp(n);
    dfs(0,-1,g,sz,dp,x);
    cout << ans << '\n';
    return 0;
}