#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> cnt;
vector <vector <int>> g;

const ll mod = 998244353;

void dfs(int v) {
  if (g[v].empty()) {
    cnt[v] = 1;
    return;
  }
  for (auto e: g[v]) {
    dfs(e);
  }
  ll p = 1;
  for (auto e: g[v]) {
    p = (p * (cnt[e]+1)) % mod;
  }
  ll s = 0;
  for (auto e: g[v]) {
    s += cnt[e] + 1; 
  }
  //cout << v << ": " << p << " " << s << "\n";
  cnt[v] = (p - s + p + 1) % mod;
}

int main() {
  int n, k;
  cin >> n >> k;

  cnt.assign(n, 0);

  vector <int> K(k);
  for (int i = 0; i < k; ++i) {
    cin >> K[i];
  }

  g.resize(n);
  for (int i = 1; i < n; ++i) {
    int x;
    cin >> x;
    x--;
    g[x].push_back(i);
  }

  dfs(0);

  cout << cnt[K[0]-1] << "\n";


  return 0;
}