#include<bits/stdc++.h>

#define len(v) (int)v.size()
#define all(v) v.begin(), v.end()

using namespace std;
using ll = long long int;
using ld = long double;

const ll MOD = 998244353;

int n, k;
vector<int> x;
vector<vector<int>> graph;
vector<int> tin, tout, d;

int cnt = 0;
void dfs(int v, int p = -1) {
    tin[v] = cnt++;
    d[v] = (p == -1 ? 0 : d[p] + 1);
    for (auto elem : graph[v]) {
        if (elem == p) continue;
        dfs(elem, v);
    }
    tout[v] = cnt++;
}

inline bool IsAncestor(int v, int u) {
    return tin[v] <= tin[u] && tout[v] >= tout[u];
}

inline bool check(const vector<int>& V, int root) {
    vector<int> mb;
    for (int i = 0; i < n; ++i) {
        bool w = true;
        for (auto elem : V) {
            if (!IsAncestor(i, elem)) {
                w = false;
                break;
            }
        }
        if (w) {
            mb.push_back(i);
        }
    }
    pair<int, int> R{-1, -1};
    for (auto elem : mb) {
        if (pair<int, int>{d[elem], elem} > R) {
            R = {d[elem], elem};
        }
    }
    if (R.second == root) return true;
    return false;
}

void solve1() {
    tin.resize(n);
    tout.resize(n);
    d.resize(n);
    dfs(0);
    int sz = (1 << n);
    vector<vector<ll>> dp(k, vector<ll>(sz, 0));
    for (int mask = 1; mask < sz; ++mask) {
        vector<int> Y;
        for (int i = 0; i < n; ++i) {
            if ((mask >> i) & 1) {
                Y.push_back(i);
            }
        }
        if (check(Y, x[0])) {
            dp[0][mask] = 1;
        }
    }
    for (int i = 1; i < k; ++i) {
        for (int mask = 1; mask < sz; ++mask) {
            for (int submask = (mask - 1) & mask; submask > 0; submask = (submask - 1) & mask) {
                vector<int> Y;
                for (int j = 0; j < n; ++j) {
                    if (((submask >> j) & 1)) {
                        Y.push_back(j);
                    }
                }
                if (check(Y, x[i])) {
                    dp[i][mask] += dp[i - 1][mask ^ submask];
                    dp[i][mask] %= MOD;
                }
            }
        }
    }
    ll ans = 0;
    for (int mask = 1; mask < sz; ++mask) {
        ans += dp[k - 1][mask];
        ans %= MOD;
    }
    cout << ans;
}

vector<int> dp;
void dfs3(int v, int p = -1) {
    dp[v] = 1;
    for (auto elem : graph[v]) {
        if (elem == p) continue;
        dfs3(elem, v);
        dp[v] += dp[elem];
    }
}

ll bin(ll a, ll n) {
    if (n == 0) return 1;
    if (n & 1) return a * bin(a, n - 1) % MOD;
    ll x = bin(a, n / 2);
    return x * x % MOD;
}

void solve3() {
    dp.resize(n);
    dfs3(0);
    ll ans = 0;
    ll all = bin(2, dp[x[0]]) - 1;
    //cout << all << endl;
    for (auto elem : graph[x[0]]) {
        if (elem > x[0]) {
            all -= bin(2, (dp[elem] - 1));
        }
    }
    all %= MOD;
    all += MOD;
    all %= MOD;
    cout << all;
}

void solve() {
    cin >> n >> k;
    x.resize(k);
    for (int i = 0; i < k; ++i) {
        cin >> x[i];
        --x[i];
    }
    graph.resize(n);
    for (int i = 1; i < n; ++i) {
        int p;
        cin >> p;
        --p;
        graph[i].push_back(p);
        graph[p].push_back(i);
    }
    if (n <= 10 && k <= 10) {
        solve1();
        return;
    } else if (k == 1) {
        solve3();
        return;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int tt = 1;
    //cin >> tt;
    while (tt--) {
        solve();
    }
}