#include<bits/stdc++.h>

using namespace std;
#define int long long
const int MOD = 998244353;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int n, k;
    cin >> n >> k;
    vector<int> mark(n, 0);
    for (int i = 0; i < k; i++) {
        int x;
        cin >> x;
        x--;
        mark[x] = 1;
    }
    int curcnt = 0;
    int curans = 1;
    for (int i = 0; i < n; i++) {
        if (mark[i]) {
            curcnt ++;
        }
        else {
            curans = curans * (1 + curcnt) % MOD;
        }
    }
    cout << curans << endl;
    return 0;        
}