#include <bits/stdc++.h>
#define int long long
using namespace std;

#ifndef LOCAL
#pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2")
#endif
const int mod = 998244353;

int binpow(int n, int p) {
    if (p == 0)
        return 1;
    if (p % 2 == 0) {
        int tmp = binpow(n, p / 2);
        return tmp * tmp % mod;
    }
    return n * binpow(n, p - 1) % mod;
}
signed main() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
#ifdef LOCAL
    freopen("./../input.txt", "r", stdin);
#endif
    int n, k;
    cin >> n >> k;
    vector<int> isp(n);
    vector<vector<int>> g(n);
    for (int i = 0; i < k; i++) {
        int u;
        cin >> u;
        u--;
        isp[u] = 1;
    }
    for (int i = 0; i < n - 1; i++) {
        int u;
        cin >> u;
        u--;
        g[u].push_back(i + 1);
    }
    int res = 0;
    vector<int> sz(n);
    auto dfs = [&](int v, auto&& dfs) -> void {
        sz[v] = 1;
        for (auto to : g[v]) {
            dfs(to, dfs);
            sz[v] += sz[to];
        }
        if (isp[v]) {
            int tmp = 1;
            res += 1;
            for (auto to : g[v]) {
                res += (binpow(2, sz[to]) - 1) * (binpow(2, tmp) - 1) % mod;
                tmp += sz[to];
                res %= mod;
            }
        }
    };
    dfs(0, dfs);
    cout << res % mod << endl;
    return 0;
}