//#define NDEBUG
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using ll = long long;

using std::vector;
using std::make_pair;
using std::pair;

int norm(ll v, const int MOD) {
    if (v < -MOD || v >= 2 * MOD) {
        v %= MOD;
    }
    if (v < 0) {
        v += MOD;
    }
    if (v >= MOD) {
        v -= MOD;
    }
    return static_cast<int>(v);
}

template<int MOD>
struct mint {
    int v;

    mint(ll x) : v(norm(x, MOD)) {
    }

    mint() : v(0) {
    }

    mint &operator+=(const mint &o) {
        v += o.v;
        if (v >= MOD) {
            v -= MOD;
        }
        return *this;
    }

    mint &operator-=(const mint &o) {
        v -= o.v;
        if (v < 0) {
            v += MOD;
        }
        return *this;
    }

    mint &operator*=(const mint &o) {
        v = static_cast<int>(static_cast<ll>(v) * o.v % MOD);
        return *this;
    }

    friend mint operator+(const mint &a, const mint &b) {
        return mint(a) += b;
    }

    friend mint operator*(const mint &a, const mint &b) {
        return mint(a) *= b;
    }

    friend mint operator-(const mint &a, const mint &b) {
        return mint(a) -= b;
    }

    friend std::ostream &operator<<(std::ostream &a, const mint &x) {
        return a << x.v;
    }

    friend std::istream &operator<<(std::istream &a, mint &x) {
        return a >> x.v;
    }

    mint pow(ll pw) const {
        //norm(pw, MOD - 1);
        mint a = *this;
        mint res = 1;
        for (; pw; pw >>= 1) {
            if (pw & 1) {
                res *= a;
            }
            a *= a;
        }
        return res;
    }
};

constexpr int MOD = 998244353;

void solve() {
    int n, k;
    std::cin >> n >> k;
    std::vector<int> mark(n);
    std::vector<int> x(k);
    for (int i = 0; i < k; ++i) {
        std::cin >> x[i];
        --x[i];
        mark[x[i]] = 1;
    }
    std::vector<std::vector<int>> g(n);
    for (int i = 1; i < n; ++i) {
        int pi;
        std::cin >> pi;
        --pi;
        g[pi].push_back(i);
    }
    std::vector<int> sz(n);
    std::vector<int> ord;
    auto dfs = [&](auto&& self, int v, int p = -1) -> void {
        ord.push_back(v);
        sz[v] = 1;
        for (int i : g[v]) {
            self(self, i, v);
            sz[v] += sz[i];
        }

    };
    dfs(dfs, 0, -1);
    mint<MOD> ans = 0;
    int cnt = 0;
    for (int i : ord) {
        if (mark[i]) {
            ++cnt;
            continue;
        }
        ans *= (cnt + 1);
    }
    std::cout << ans << '\n';
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
}

