#include <bits/stdc++.h>
using namespace std;
#define int long long

vector<int> f(vector<int> a, int i) {
    int n = a.size();
    vector<int> b(n);
    if (i == 0) {
        return a;
    }
    if (i == 1) {
        for (int i = 0; i < n; i++) {
            b[i] = a[n - 1 - i];
        }
        return b;
    }
    if (i == 2) {
        for (int i = 0; i < n; i++) {
            b[i] = n + 1 - a[i];
        }
        return b;
    }
    for (int i = 0; i < n; i++) {
        b[a[i] - 1] = i + 1;
    }
    return b;
}

const int MOD = 998244353;

int pw(int a, int b) {
    ////cout << a << " " << b << endl;
    if (b == 0) {
        return 1;
    }
    if (b % 2 == 1) {
        return (pw(a, b - 1) * a) % MOD;
    }
    int t = pw(a, b / 2);
    return (t * t) % MOD;
}

int g(vector<int>& a) {
    int ans = 0;
    for (int i = 0; i < a.size(); i++) {
        ans = (ans + pw(a[i], i + 1)) % MOD;
        ////cout << ans << " " << a[i] << " " << i + 1 << endl;
    }
    /*
    for (auto e : a) {
        //cout << e << " ";
    }
    //cout << endl << ans << endl;*/
    return ans;
}

int ind(vector<vector<int>>& a, vector<int>& b) {
    for (int i = 0; i < a.size(); i++) {
        if (a[i] == b) {
            return i;
        }
    }
    return -1;
}

void dfs(int v, vector<vector<int>> &gr, vector<bool>& used, vector<int>& sz) {
    used[v] = true;
    for (auto e : gr[v]) {
        if (!used[e]) {
            dfs(e, gr, used, sz);
            sz[v] += sz[e];
        }
    }
    sz[v] += 1;
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    //cout.tie(0);

    int n, q;
    cin >> n >> q;
    vector<int> x(q), p(n);
    for (int i = 0; i < q; i++) {
        cin >> x[i];
    }
    for (int i = 1; i < n; i++) {
        cin >> p[i];
    }

    sort(x.begin(), x.end());
    int j = 0;
    int cnt = 0;
    int ans = 1;
    for (int i = 0; i < n; i++) {
        if (j < q && x[j] == (i + 1)) {
            cnt += 1;
            j += 1;
        } else {
            ans = (ans * (1 + cnt)) % MOD;
        }
    }
    cout << ((ans) % MOD + MOD) % MOD << endl;
}

/*
    vector<vector<int>> gr(n);
    for (int i = 1; i < n; i++) {
        gr[p[i] - 1].push_back(i);
    }
    vector<int> sz(n, 0);
    vector<bool> used(n, 0);
    dfs(0, gr, used, sz);
  //  cout << "ready" << endl;
    vector<int> f(n + 1, 1);
    for (int i = 1; i <= n; i++) {
        f[i] = (f[i - 1] * 2) % MOD;
    }
    //cout << "cnt" << endl;
    int ans = 1;
   // cout << ans << endl;
    ans = ((f[sz[x[0] - 1]] - 1) % MOD + MOD) % MOD;
    for (auto e : gr[x[0] - 1]) {
        ans = ((ans - (f[sz[e]] - 1)) % MOD + MOD) % MOD;
    }
    cout << ans << endl;
}
*/