#pragma GCC optimize("O3,unroll-loops")
#include<bits/extc++.h>
#pragma GCC target("avx2,popcnt")

#define all(_a) _a.begin(), _a.end()
#define sz(_a) int32_t(_a.size())
#define ll long long
#define int long long
#define fi first
#define se second
#define deb(_a) cerr << __LINE__ << ' ' << (#_a) << ": " << _a << '\n';

using namespace std;

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for (auto i: v) out << i << ' ';
    return out;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& v) {
    for (auto &i: v) in >> i;
    return in;
}

inline void solve();

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

int mod = 998244353;

inline void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    cin >> a;
    sort(all(a));
    ll res = 1;
    for (int i = 1, ind = 0; i <= n; i++) {
        if (ind < m && i == a[ind]) {
            ind++;
        } else {
            res = res * (ind + 1) % mod;
        }
    }
    cout << res;
}