#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cassert>
#include <random>
#define rep(n) for (int (i) = 0; (i) < (n); (i)++)
#define all(n) (n).begin(), (n).end()
#define rall(n) (n).rbegin(), (n).rend()
#define mp make_pair
#define ll long long
#define ld long double
//#define int long long
//#define FILE

using namespace std;

const int mod = 998244353;

int power(int a, int b) {
    if (b == 0)
        return 1;
    else if (b % 2 == 0) {
        int res = power(a, b / 2);
        return (ll) res * res % mod;
    }
    else {
        return (ll) power(a, b - 1) * a % mod;
    }
}

vector<bool> used;
vector<vector<int>> g;
vector<vector<int>> dp;
vector<int> s;

int ans = 0;
int dfs(int v) {
    s[v] = 1;
    vector<int> A;
    for (int u : g[v]) {
        s[v] += dfs(u);
    }
    int sz = s[v];
    if (used[v]) {
        ans = power(2, sz - 1);
        vector<array<int, 3>> dp(g[v].size() + 1);
        dp[0][0] = 1;
        for (int i = 0; i < g[v].size(); i++) {
            int u = g[v][i];
            //dp[i + 1] = ?;
            //from dp[i];
            dp[i + 1][0] = 1;
            dp[i + 1][1] = (power(2, s[u]) - 1 + dp[i][1]) % mod;
            dp[i + 1][2] = ((ll) dp[i][2] * power(2, s[u]) + (ll) dp[i][1] * (power(2, s[u]) - 1)) % mod;
        }
        ans += dp[g[v].size()][2];
        ans %= mod;
    }
    return sz;
}

void solve() {
    int n, k; cin >> n >> k;
    used.resize(n), g.resize(n);
    dp.resize(n), s.resize(n);
    rep(k) {
        int v; cin >> v;
        v--;
        used[v] = true;
    }
    for (int i = 2; i <= n; i++) {
        int p; cin >> p;
        g[p - 1].push_back(i - 1);
    }
    int root = 0;
    dfs(root);
    cout << ans << '\n';
}

int main() {
    //ios_base::sync_with_stdio(false);
    //cin.tie(nullptr);
#ifdef FILE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "W", stdout);
#endif
    int tt = 1;
    //cin >> tt;
    while (tt--) {
        solve();
    }
}