#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <set>
#include <map>
#include <random>
#include <cmath>
#include <numeric>

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using namespace std;

const int N = 1'000'100;
int p[N];
vector<int> ch[N];
int sz[N];

void calc_s(int v) {
    sz[v] = 1;
    for (auto u : ch[v]) {
        calc_s(u);
        sz[v] += sz[u];
    }
}

const int MOD = 998'244'353;
int sum_mod(int a, int b) {
    int ans = a + b;
    if (ans >= MOD) ans -= MOD;
    if (ans < 0) ans += MOD;
    return ans;
}
int binpow(int n, int x) {
    if (x == 0) return 1;
    if (x % 2 == 0)
        return binpow((1ll * n * n) % MOD, x / 2);
    return (1ll * n * binpow(n, x - 1)) % MOD;
}

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> x(k);
    for (int i = 0; i < k; ++i) {
        cin >> x[i];
    }
    for (int i = 2; i <= n; ++i) {
        cin >> p[i];
        ch[p[i]].push_back(i);
    }
    calc_s(1);
    int ans = 0;
    int v = x[0];
    for (auto u : ch[v]) {
        ans = sum_mod(ans, (((1ll * sz[u] * (sz[v] - sz[u])) % MOD) * binpow(2, sz[v] - 2)) % MOD);
    }
    cout << sum_mod((1ll * ans * binpow(2, MOD - 2)) % MOD, 1);
}