#include <bits/stdc++.h>
#define int long long

using namespace std;
const int MOD = 998'244'353;

ostream& operator<<(ostream& out, vector<int> v) {
    for (auto el : v) {
        out << el << " ";
    }
    return out << "\n";
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<bool> v(n);
    for (int i = 0; i < k; i++) {
        int a;
        cin >> a;
        v[a - 1] = 1;
    }
    vector<int> p(n);
    for (int i = 1; i < n; i++) {
        cin >> p[i];
    }
    int cnt = 1;
    int ans = 1;
    for (int i = 0; i < n; i++) {
        if (v[i]) {
            cnt++;
        }
        else {
            ans = ans * cnt % MOD;
        }
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
