// #define _GLIBCXX_DEBUG
// #pragma GCC optimize("O3,unroll-loops")
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
using ll = long long;
using ld = long double;
ll MOD = 998244353;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n, k;
    cin>>n>>k;
    vector<ll> v(k);
    for (auto&e:v){cin>>e;}
    sort(v.begin(), v.end());
    ll ind = 0;
    ll ans = 1;
    for (ll i = 0; i<n; i++){
        while(ind < k){
            if (v[ind] > i){break;}
            ind++;
        }
        // cout<<ind<<' ';
        ans = (ans*(ind+1))%MOD;
    }
    cout<< ans;
    return 0;
}