#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e18, MOD = 998244353;
mt19937 rnd(time(0));

void solve();

int mt(int a, int b){
    return (a * 1ll * b) % MOD;
}
int sm(int a, int b){
    if (a + b >= MOD){
        return a + b - MOD;
    }
    return a + b;
}
int rz(int a, int b){
    if (a - b < 0){return a - b + MOD;}
    return a - b;
}
vector<int> u;
vector<vector<int>> g;
vector<int> pw;
vector<int> sz;
int ans;
void dfs(int v){
    int k = 2;
    sz[v] = 1;
    for (auto to : g[v]){
        dfs(to);
        sz[v] += sz[to];
        k = mt(k, pw[sz[to]]);
    }
    if (u[v]){ans = sm(ans, rz(k, sz[v]));}
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    u.resize(n);
    g.resize(n);
    pw.resize(n + 1);
    sz.resize(n);
    pw[0] = 1;
    for (int i = 1; i < n + 1; i++){
        pw[i] = mt(2, pw[i - 1]);
    }
    for (int i = 0; i < k; i++){
        int x;
        cin >> x;
        x--;
        u[x] = 1;
    }
    for (int i = 1; i < n; i++){
        int p;
        cin >> p;
        p--;
        g[p].push_back(i);
    }
    ans = 0;
    dfs(0);
    cout << ans;
}
