#include <bits/stdc++.h>

using namespace std;
using ll = int64_t;
const ll inf = 1e18;
void solve();

template<typename T, typename T1> T remax(T& x, T1 y) { if (x < y) x = y; return x; }
template<typename T, typename T1> T remin(T& x, T1 y) { if (y < x) x = y; return x; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
//    cin >> t;
    while (t--) solve();
}
#define int int64_t

const int mod = 998244353;

int binpow(int n, int k) {
    int rs = 1;
    while (k) {
        if (k & 1) rs = rs * n % mod;
        n = n * n % mod;
        k >>= 1;
    }
    return rs;
}

void solve() {
    int n, k; cin >> n >> k;
    vector<int> a(k), mark(n);
    for (auto& x : a) {
        cin >> x, --x;
        mark[x] = 1;
    }
    vector<vector<int>> g(n);
    for (int i = 1; i < n; ++i) {
        int p; cin >> p;
        --p;
        g[p].emplace_back(i);
    }
    vector<int> sz(n);
    int ans = 0;

    auto dfs = [&](auto& self, int v) -> void {
        sz[v] = 1;
        int sum = 0;
        for (int u : g[v]) {
            self(self, u);
            sz[v] += sz[u];
        }
        if (mark[v]) {
            int val = (sz[v] >= 3 ? binpow(2, sz[v] - 3) : 0);
            for (int u : g[v]) {
                ans += sum * sz[u] % mod * val % mod;
                ans %= mod;
                sum += sz[u];
            }
            ans += binpow(2, sz[v] - 1);
            ans %= mod;
        }
    };
    dfs(dfs, 0);
    cout << ans;
}
