#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
#define int long long
using ll = long long;
using namespace std;
// #pragma GCC optimize("O3, unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
//  using ordered_set = tree<int, null_type, less<int>, rb_tree_tag,
//  tree_order_statistics_node_update>;
const int mod = 998244353;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, k;
    cin >> n >> k;
    vector<int> x(k);
    for (auto& t : x) {
        cin >> t;
        t--;
    }
    vector<vector<int>> g(n);
    for (int i = 0; i < n - 1; i++) {
        int p;
        cin >> p;
        p--;
        // g[i].push_back(p);
        g[p].push_back(i + 1);
    }
    vector<int> dp(n, 1);
    vector<int> sz(n, 1);
    auto dfs = [&](int v, int p, auto&& dfs) -> void {
        int prod = 1;
        int sm = 0;
        for (auto& to : g[v]) {
            dfs(to, v, dfs);
            sz[v] += sz[to];
            dp[v] += dp[to];
            prod = prod * (sz[to] + 1) % mod;
            sm += sz[to];
            sm = sm % mod;
        }
        dp[v] += prod;
        dp[v] %= mod;
        dp[v] = dp[v] - 1 - sm;
        dp[v] %= mod;
        dp[v] += mod;
        dp[v] %= mod;
    };
    dfs(0, -1, dfs);
    cout << dp[x[0]] + 1 << '\n';
    return 0;
}
