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

#define int long long
#define all(x) (x).begin(), (x).end()
using ll = long long;
using ld = long double;
const char nl = '\n';

template<typename T>
istream &operator>> (istream& in, vector<T>& a) {
    for (auto &el : a) in >> el;
    return in;
}

template<typename T>
ostream& operator<< (ostream& out, vector<T> &a) {
    for (auto &el : a) out << el << ' ';
    return out;
}

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

signed main() {
    int n, k;
    cin >> n >> k;
    int mod = 998244353;
    vector<int> pws(n + 1);
    pws[0] = 1;
    for (int i = 1; i <= n; i++) {
        pws[i] = pws[i - 1] * 2 % mod;
    }
    vector<int> q(k);
    cin >> q;
    vector<vector<int>> g(n);
    for (int i = 1; i < n; i++) {
        int p;
        cin >> p;
        p--;
        g[p].push_back(i);
    }

    vector<int> cnt(n);

    auto dfs = [&](auto self, int v, int p) -> void {
        cnt[v] = 1;
        for (auto u : g[v]) {
            if (u == p) continue;
            self(self, u, v);
            cnt[v] += cnt[u];
        }
    };

    dfs(dfs, 0, 0);

    int v = q[0] - 1;
    int ans = 1;
    for (auto u : g[v]) {
        ans *= pws[cnt[u]];
        ans %= mod;
    }
    for (auto u : g[v]) {
        ans -= (pws[cnt[u]] - 1);
        if (ans < 0)
            ans += mod;
    }
    ans--;
    if (ans < 0)
        ans += mod;
    ans *= 2;
    ans %= mod;
    for (auto u : g[v]) {
        ans += pws[cnt[u]] - 1;
        ans %= mod;
    }
    ans++;
    cout << ans % mod;
}
