#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(a) a.begin(), a.end()
const int MAXN = 1e6 + 1, MOD = 998244353;
void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> x(n);
    for (int i = 0; i < k; ++i) {
        int p;
        cin >> p;
        x[p - 1] = 1;
    }
    vector<int> p(n - 1);
    for (auto &i : p) cin >> i;
    int cur = 0;
    ll ans = 1;
    for (int i = 0; i < n; ++i) {
        if (!x[i]) {
            ans *= cur + 1;
            ans %= MOD;
        } else {
            cur++;
        }
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}