
#include <iostream>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <map>
#include <unordered_map>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
ll mod = 998244353;
ll pow(ll n, ll k) {
    ll ans = 1;
    while (k) {
        if (k & 1) ans = ans * n % mod;
        n = n * n % mod;
        k >>= 1;
    }
    return ans;
}
struct LiChao {
    struct Line {
        ll a = -1e18, b = 0;
        ll operator()(ll x) {
            return a + b * x;
        }
    };
    struct Node {
        Line li;
        ll l = 0, r = 0;
    };
    ll n;
    vector<Node> tree{Node(), Node()};
    LiChao(ll n) : n(n) {
    }
    void update(Line line, ll l, ll r, ll v) {
        if (l == r) {
            tree[v] = {line};
            return;
        };
        ll m = (l + r) >> 1;
        if (tree[v].li(m) < line(m)) {
            swap(line, tree[v].li);
        }
        if (tree[v].r == 0) {
            tree[v].r = tree.size();
            tree.push_back(Node());
            update(line, m + 1, r, tree[v].r);
            return;
        }
        if (tree[v].l == 0) {
            tree[v].l = tree.size();
            tree.push_back(Node());
            update(line, l, m, tree[v].l);
            return;
        }
        if (tree[tree[v].l].li(l) < line(l)) {
            update(line, l, m, tree[v].l);
        } else if (tree[tree[v].r].li(r) < line(r)) {
            update(line, m + 1, r, tree[v].r);
        }
    }
    ll get(ll x, ll l, ll r, ll v) {
        if (v == 0) return -1e18;
        if (l == r) {
            return tree[v].li(x);
        }
        ll m = (l + r) >> 1;
        if (x <= m) return max(tree[v].li(x), get(x, l, m, tree[v].l));
        else return max(tree[v].li(x), get(x, m + 1, r, tree[v].r));
    }
    void update(Line l) {
        update(l, -n, n, 1);
    }
    ll get(ll x) {
        return get(x, -n, n, 1);
    }
};
vvll g;
vll a;
vll sz, pows;
ll ans = 0;
void dfs(ll v, ll pr) {
    ll cur = 0;
    for (ll u : g[v]) {
        if (u == pr) continue;
        dfs(u, v);
        sz[v] += sz[u];
    }
    for (ll u : g[v]) {
        if (u == pr) continue;
        if (a[v])
        cur += (pows[sz[v] - sz[u] - 1] - 1) % mod * (pows[sz[u]] - 1) % mod;
    }
    if (a[v]) ans = (ans + pows[sz[v] - 1]) % mod;
    cur /= 2;
    ans += cur;
    ans %= mod;
}
void solve() {
    ll n, k;
    cin >> n >> k;
    a = vll(n);
    g = vvll(n);
    
    for (ll i = 0; i < k; ++i) {
        ll x;
        cin >> x;
        a[x - 1] = 1;
    }
    for (ll i = 0; i < n - 1; ++i) {
        ll pr;
        cin >> pr;
        g[i + 1].push_back(pr - 1);
        g[pr - 1].push_back(i + 1);
    }
    sz = vll(n, 1);
    pows = vll(n + 1);
    pows[0] = 1;
    for (ll i = 1; i <= n; ++i) pows[i] = (pows[i - 1] * 2) % mod;
    dfs(0, 0);
    cout << ans << endl;
}

int main() {
    //reopen("in.txt", "r", stdin);
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int t = 1;
    for (int i = 0; i < t; ++i) {
        solve();
    }
    cout << endl;
    return 0;
}
