#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;

using namespace std;
using ll = long long;
using ld = long double;

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define int long long

const int MOD = 998244353;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> x(k);
    vector<bool> used(n);
    for (int i = 0; i < k; i++) {
        cin >> x[i];
        used[x[i] - 1] = true;
    }
    int cnt = 1;
    int ans = 1;
    for (int i = 0; i < n; i++) {
        if (used[i]) {
            cnt++;
        } else if (cnt > 0){
            ans = ans * cnt % MOD;
        }
    }
    cout << ans;
}
