#include<bits/stdc++.h>

const int mod = 998244353;

int add(int a, int b) {
    return a + b >= mod ? a + b - mod : a + b;
}
int sub(int a, int b) {
    return a >= b ? a - b : a + mod - b;
}
int mul(int a, int b) {
    return 1ll * a * b % mod;
}
int power(int a, int b) {
    int ret = 1;
    for (; b; b >>= 1, a = mul(a, a)) {
        if (b & 1) ret = mul(ret, a);
    }
    return ret;
}
int inv(int x) {
    return power(x, mod - 2);
}

const int N = 510, K = 510;

int n, k;
bool mark[N];
std::vector<int> adj[N];
int dp[N][K + 1];

void dfs(int u, int p) {
    if (mark[u]) {
        for (int i = 0; i <= k; ++i) {
            dp[u][i] = i + 2;
        }
        for (auto to : adj[u]) {
            if (to == p) continue;
            dfs(to, u);
            for (int i = 0; i <= k; ++i) {
                dp[u][i] = mul(dp[u][i], dp[to][i + 1]);
            }
        }
        // std::cout << u << std::endl;
        // for (int i = 0; i <= k; ++i) {
        //     std::cout << dp[u][i] << ' ';
        // }
        // std::cout << std::endl;
        for (int i = 0; i <= k; ++i) {
            int s0 = 1, s1 = 0;
            for (auto to : adj[u]) {
                if (to == p) continue;
                s1 = add(mul(s1, dp[to][i]), mul(s0, sub(dp[to][i + 1], dp[to][i])));
                s0 = mul(s0, dp[to][i]);
            }
            // std::cout << u << ' ' << i << ' ' << s0 << ' ' << s1 << std::endl;
            dp[u][i] = sub(dp[u][i], mul(i + 1, add(s0, s1)));
            // dp[u][i] = sub(dp[u][i], mul(i + 1, sub(s1, mul(s0, adj[u].size() - 1))));
        }
    } else {
        for (int i = 0; i <= k; ++i) {
            dp[u][i] = i + 1;
        }
        for (auto to : adj[u]) {
            if (to == p) continue;
            dfs(to, u);
            for (int i = 0; i <= k; ++i) {
                dp[u][i] = mul(dp[u][i], dp[to][i]);
            }
        }
    }
    // std::cout << u << std::endl;
    // for (int i = 0; i <= k; ++i) {
    //     std::cout << dp[u][i] << ' ';
    // }
    // std::cout << std::endl;
}

int main() {
    std::cin.tie(nullptr)->sync_with_stdio(false);

    std::cin >> n >> k;
    for (int i = 0; i < k; ++i) {
        int x;
        std::cin >> x;
        --x;
        mark[x] = true;
    }
    for (int i = 1; i < n; ++i){
        int p;
        std::cin >> p;
        --p;
        adj[p].push_back(i);
    }
    dfs(0, -1);
    std::cout << dp[0][0];
    
}