#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <numeric>

const long long modul = 998'244'353;

#define LOCAL
#ifdef LOCAL
#else
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#endif

long long BinPow(long long x, long long y) {
    if (y == 0) {
        return 1;
    }

    if (y % 2 == 0) {
        long long now = BinPow(x, y / 2);
        return (now * now) % modul;
    }

    return (BinPow(x, y - 1) * x) % modul;
}

std::vector<long long> pref_sum;
struct WorkWithTree {
    std::vector<std::vector<int>>& tree;
    std::vector<bool>& used;
    std::vector<int> count;
    std::vector<long long> dp;
    long long cnt = 1;

    void DFS(int u) {
        std::vector<long long> array;

        for (int v : tree[u]) {
            DFS(v);

            count[u] += count[v];

            if (count[v] != 0) {
                array.push_back(count[v]);
            }
        }

        if (used[u]) {
            dp[u] = BinPow(2, count[u] - 1);

            if (array.size() > 0) {
                long long sum = array[0];
                for (int i = 1; i < array.size(); ++i) {
                    dp[u] += (BinPow(2, sum) - 1) * (BinPow(2, array[i]) - 1);
                    sum += array[i];

                    dp[u] %= modul;
                }
            }

            count[u] = 0;
        } else {
            cnt *= pref_sum[u];
            cnt %= modul;
        }
    }

    WorkWithTree(std::vector<std::vector<int>>& tree, std::vector<bool>& used) : tree(tree), used(used),
      count(used.size(), 1), dp(used.size()) {
        DFS(0);
        std::cout << cnt << '\n';
        std::exit(0);
      }
};

void Solve() {
    pref_sum = std::vector<long long>(n + 1);
    int n, k;
    std::cin >> n >> k;

    std::vector<bool> used(n);
    int x;

    for (int i = 0; i < k; ++i) {
        std::cin >> x;
        --x;

        used[x] = true;
    }

    for (int i = 0; i < n; ++i) {
        pref_sum[i + 1] = pref_sum[i] + int(used[i]);
    }

    std::vector<std::vector<int>> tree(n);
    for (int i = 0; i < n - 1; ++i) {
        std::cin >> x;
        --x;

        tree[x].push_back(i + 1);
    }

    WorkWithTree work(tree, used);
    long long res = 1;

    for (int i = 0; i < n; ++i) {
        if (used[i]) {
            res *= work.dp[i];
            res %= modul;
        }
    }

    std::cout << res << '\n';
}

int main() {
    #ifdef LOCAL
        std::cout << '\n';
    #else
        std::ios_base::sync_with_stdio(false);
        std::cin.tie(nullptr);
    #endif

    int t = 1;
    //std::cin >> t;

    for (int i = 0; i < t; ++i) {
        Solve();
    }
}