#include <bits/stdc++.h>
#include <immintrin.h>

using namespace std;

void solve();

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    cout << fixed << setprecision(20);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}

const int mod = 998'244'353;

int add(int a, int b) {
    return a + b >= mod ? a + b - mod : a + b;
}

int sub(int a, int b) {
    return a >= b ? a - b : a + mod - b;
}

int mul(int a, int b) {
    return 1ll * a * b % mod;
}

int bin_pow(int a, int x) {
    int res = 1;
    while (x) {
        if (x & 1) {
            res = mul(res, a);
        }
        a = mul(a, a);
        x >>= 1;
    }
    return res;
}

int inv(int a) {
    return bin_pow(a, mod - 2);
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> has_task(n, 0);
    for (int i = 0; i < k; i++) {
        int x;
        cin >> x; x--;
        has_task[x] = 1;
    }
    vector<vector<int>> g(n);
    for (int i = 1; i < n; i++) {
        int p;
        cin >> p; p--;
        g[p].push_back(i);
    }
    vector<int> szt(n), sz(n);
    {
        auto calc_sz = [&](auto calc_sz, int s) -> void {
            szt[s] = has_task[s];
            sz[s] = 1;
            for (int i : g[s]) {
                calc_sz(calc_sz, i);
                szt[s] += szt[i];
                sz[s] += sz[i];
            }
        };
        calc_sz(calc_sz, 0);
    }
    vector<vector<int>> mem(n);
    auto dfs = [&](auto dfs, int s, int l, int r, int ml = 0) -> int {
        if (!has_task[s]) {
            int cnt = 0, idx = -1;
            for (int i : g[s]) {
                if (szt[i]) {
                    cnt++;
                    idx = i;
                }
            }
            if (cnt != 1) {
                vector<int> ret(r - l + 1);
                for (int i = l; i <= r; i++) {
                    ret[i - l] = i;
                }
                for (int i : g[s]) {
                    if (szt[i]) {
                        int ind = dfs(dfs, i, l, r);
                        for (int j = 0; j < r - l + 1; j++) {
                            ret[j] = mul(ret[j], mem[ind][j]);
                        }
                    } else {
                        ml += sz[i];
                    }
                }
                for (int i = l; i <= r; i++) {
                    ret[i - l] = mul(ret[i - l], bin_pow(i, ml));
                }
                mem[s] = ret;
                return s;
            } else if (cnt == 1) {
                return dfs(dfs, idx, l, r, ml + sz[s] - sz[idx]);
            }
        }
        vector<int> p1(r - l + 1, 1), p2(r - l + 1, 1), p3(r - l + 1, 1);
        for (int i = l; i <= r; i++) {
            p1[i - l] = i + 1;
            p2[i - l] = i;
        }
        int ml2 = 0;
        vector<int> cntt(30, 0);
        vector<int> frac(r - l + 1);
        for (int i = l; i <= r; i++) {
            frac[i - l] = mul(i + 1, inv(i));
        }
        for (int i : g[s]) {
            if (szt[i]) {
                int ind = dfs(dfs, i, l, r + 1);
                for (int j = 0; j < r - l + 1; j++) {
                    p1[j] = mul(p1[j], mem[ind][j + 1]);
                    p2[j] = mul(p2[j], mem[ind][j]);
                    p3[j] = add(p3[j], mul(sub(mem[ind][j + 1], mem[ind][j]), inv(mem[ind][j])));
                }
            } else {
                ml2 += sz[i];
                if (sz[i] < 30) {
                    cntt[sz[i]]++;
                } else {
                    for (int j = 0; j < r - l + 1; j++) {
                        p3[j] = add(p3[j], sub(bin_pow(frac[j], sz[i]), 1));
                    }
                }
            }
        }
        for (int i = 0; i < 30; i++) {
            for (int j = 0; j < r - l + 1; j++) {
                p3[j] = add(p3[j], mul(cntt[i], sub(bin_pow(frac[j], i), 1)));
            }
        }
        for (int j = 0; j < r - l + 1; j++) {
            p1[j] = mul(p1[j], bin_pow(l + j + 1, ml2));
            p2[j] = mul(p2[j], bin_pow(l + j, ml2));
            // p3[j] = add(p3[j], mul(sub(bin_pow(l + j + 1, ml2), bin_pow(l + j, ml2)), inv(bin_pow(l + j, ml2))));
        }
        vector<int> ret(r - l + 1);
        for (int i = 0; i < r - l + 1; i++) {
            ret[i] = mul(sub(p1[i], mul(p2[i], p3[i])), bin_pow(i + l, ml));
        }
        mem[s] = ret;
        return s;
    };
    cout << mem[dfs(dfs, 0, 1, 1)][0] << '\n';

}
