#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;

using ll = long long;

// template <class T> using ordered_set = tree<T, nullptr, less<T>, rb_tree_tag, tree_node_statistics_update>;

const ll inf = ll(1e18) + 2;
const ll mod = 998244353;

struct node {
    ll x;
    ll p;

    node(ll x_ = -inf, ll p_ = 0) {
        x = x_;
        p = p_;
    }
};

node c(node a, node b) {
    node j;
    j.x = a.x + b.x;
    j.p = 0;
    return j;
}

struct st {

};

ll bp(ll a, ll n) {
    if (n == 0) {
        return 1 % mod;
    }
    ll k = bp(a, n / 2);
    if (n % 2 == 0) {
        return (k * k) % mod;
    }
    return (((k * k) % mod) * a) % mod;
}

vector<ll> d;
vector<ll> s;

vector<ll> a2;

void dfs(ll v, ll prev, vector<vector<ll>> &g) {
    s[v] = 1;
        for (auto i : g[v]) {
            if (i != prev) {
                dfs(i, v, g);
                s[v] += s[i];
            }
        }
    if (a2[v] == 1) {
        ll res = bp(2ll, s[v]) - 1 + mod;
        for (auto i : g[v]) {
            if (i != prev) {
                res -= s[i] * (s[i] - 1) / 2;
                res -= s[i];
                res %= mod;
                if (res < 0) {
                    res += mod;
                }
            }
        }
        res %= mod;
                if (res < 0) {
                    res += mod;
                }
        cout << res << endl;
        exit(0);
    } else {
        for (auto i : g[v]) {
            d[v] = 0;
        }
    }
}

inline void solve() {
    ll n, k;
    cin >> n >> k;
    d.resize(n, 1);
    s.resize(n, 0);
    a2.resize(n, 0);
    vector<ll> a(k);
    for (ll i = 0; i < k; i++) {
        cin >> a[i];
        a[i]--;
        a2[a[i]] = 1;
    }
    vector<vector<ll>> g(n);
    for (ll i = 1; i < n; i++) {
        ll x;
        cin >> x;
        x--;
        g[x].push_back(i);
        g[i].push_back(x);
    }
    dfs(0, -1, g);
    cout << d[0] << endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll q = 1;
    // cin >> q;
    while (q--) {
        solve();
    }
    return 0;
}
