#include <iostream>
#include <fstream>
#include <complex>
#include <vector>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>

#define iset(t) __gnu_pbds::tree<t, __gnu_pbds::null_type, less<t>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>

#define V vector
#define P pair
#define F first
#define S second

#ifdef LOC
#define $(x) x
#define clog(x) clog << x
#else
#define $(x)
#define clog(x)
#endif

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<int> ci;
typedef complex<ll> cll;
typedef complex<ld> cld;
typedef P<int, int> pi;
typedef P<ll, ll> pll;
typedef V<bool> vb;
typedef V<int> vi;
typedef V<ll> vll;

const ll mod = 998244353;

ll get_pow(ll x, ll n, ll m) {
    if (!n) return 1%m;
    ll pw = get_pow(x, n/2, m);
    pw = pw*pw%m;
    if (n%2) pw = pw*x%m;
    return pw;
}

int n, k;
vi x, p;
V<vi> ladj;
vi sz;

ll ans = 0;

void dfs_init(int u, int p) {
    for (auto v : ladj[u]) {
        if (v == p) continue;
        dfs_init(v, u);
        sz[u] += sz[v];
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    #ifdef STR
    freopen("ti.txt", "r", stdin);
    freopen("tm.txt", "o", stdout);
    #endif

    cin >> n >> k;

    x.resize(k);
    p.resize(n, -1);

    for (auto &y : x) {
        cin >> y;
        y--;
    }

    for (int i = 1; i < n; i++) {
        cin >> p[i];
        p[i]--;
    }

    clog("sus" << endl);

    ladj.resize(n);

    for (int i = 1; i < n; i++) {
        ladj[i].push_back(p[i]);
        ladj[p[i]].push_back(i);
    }

    sz.resize(n, 1);
    dfs_init(0, -1);

    // ans += get_pow(2, sz[x[0]]-1, mod);

    vi c;
    for (auto v : ladj[x[0]]) {
        if (v == p[x[0]]) continue;
        c.push_back(sz[v]);
    }

    int pref = 1;
    for (int i = 0; i < (int)c.size(); i++) {
        ans = (ans + (get_pow(2, pref, mod) - 1) * (get_pow(2, c[i], mod) - 1) % mod) % mod;
        pref += c[i];
    }

    cout << ans << "\n";

    return 0;
}