#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define all(x) x.begin(), x.end()

template<typename T>
int isz(const T& v) {
  return (int)v.size();
}

template<typename T>
void reuniq(T& v) {
  v.erase(unique(all(v)), v.end());
}

template<typename X, typename Y>
bool remin(X& x, const Y& y) {
  if (y < x) {
    x = y;
    return true;
  }
  return false;
}

template<typename X, typename Y>
bool remax(X& x, const Y& y) {
  if (y > x) {
    x = y;
    return true;
  }
  return false;
}

constexpr int kMod = 998'244'353;
constexpr int kMaxN = 1e6 + 10;

vector<int> g[kMaxN];
int sz[kMaxN];
int teta[kMaxN];

int add(int a, int b) {
  a += b;
  if (a >= kMod) {
    a -= kMod;
  }
  return a;
}

int sub(int a, int b) {
  a -= b;
  if (a < 0) {
    a += kMod;
  }
  return a;
}

int mul(int a, int b) {
  return ll(a) * b % kMod;
}

int binpow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) {
      ans = mul(ans, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return ans;
}

int inv(int a) {
  return binpow(a, kMod - 2);
}

int dv(int a, int b) {
  return mul(a, inv(b));
}

void dfs(int u) {
  sz[u] = 1;
  for (auto v : g[u]) {
    dfs(v);
    sz[u] += sz[v];
  }
}

void compute(int test_case) {
  int n, k;
  cin >> n >> k;
  vector<int> x(k);
  for (auto& i : x) {
    cin >> i;
  }
  for (int i = 2; i <= n; ++i) {
    int p;
    cin >> p;
    g[p].push_back(i);
  }
  dfs(1);
  int u = x[0];
  for (int i = 1; i <= n; ++i) {
    int pw = binpow(2, sz[i]);
    teta[i] = dv(sub(pw, 1), pw);
  }
  int ans = 0;
  int sum = 0;
  int C = 0;
  for (auto v : g[u]) {
    int pw = binpow(2, sz[v]);
    ans = add(ans, mul(sum, mul(sub(pw, 1), C)));
    sum = add(sum, teta[v]);
    C = add(C, pw);
  }
  ans = add(ans, C);
  cout << ans << "\n";
}

signed main() {
  #ifdef LOCAL
    freopen("/home/olymp/work/in.txt", "r", stdin);
    // freopen("/home/olymp/work/out.txt", "w", stdout);
  #endif
  cin.tie(0)->sync_with_stdio(0);
  int t = 1;
  // cin >> t;
  for (int tt = 1; tt <= t; ++tt) {
    compute(tt);
  }
  return 0;
}