#pragma GCC optimize("Ofast")
#pragma GCC target("avx2", "bmi2", "popcnt", "lzcnt")
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <climits>
#include <queue>
#include <random>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <vector>
#include <string>

using namespace std;
using namespace __gnu_pbds;

typedef long long int lint;
typedef long double ld;
typedef tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ost;

constexpr int MOD =  998'244'353;

inline void preset() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
}

vector <vector<int>> gr;
vector <int> p;
vector <lint> sz;
vector <lint> dp;
constexpr int ROOT = 0;

inline void resize(size_t n) {
    gr.resize(n);
    p.resize(n);
    sz.resize(n);
    dp.resize(n, 0);
    p[ROOT] = -1;
}

lint binpow(lint a, lint c) {
    lint res = 1;
    for (;c; c >>= 1) {
        if (c & 1) res = res * a % MOD;
        a = a * a % MOD;
    }
    return res;
}

void dfs(int v) {
    sz[v] = 1;
    for (int u: gr[v]) if (u != p[v]) {
        dfs(u);
        sz[v] += sz[u];
        dp[v] -= binpow(2, sz[u]) - 1;
    }
    // cout << v << " " << dp[v] << endl;
    dp[v] += 2 * binpow(2, sz[v] - 1) - 1;
}

int main() {
    preset();
    int n, k; cin >> n >> k;
    resize(n);
    vector <int> x(k);
    for (auto &el: x) {cin >> el; --el;}
    for (int i = 1; i < n; ++i) {
        cin >> p[i];
        --p[i];
        gr[p[i]].push_back(i);
    }
    dfs(0);
    cout << dp[x[0]];
    return 0;
}