#include <bits/stdc++.h>
#define endl '\n'
#define all(a) (a).begin(), (a).end()
#define len(a) (int) (a).size()
#define forn(i, n) for (int (i) = 0; (i) < (n); ++(i))
#define int long long
using namespace std;
void solve();
mt19937 rnd(2007);
signed main(){
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    swap(rng, rnd);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    solve();
}


const int mod = (int) 998244353;
const int maxn = (int) 1e6 + 7;
int fact0[maxn], fact_[maxn], pwn[maxn], pwm[maxn];



int C(int n, int k){
    if (n < k)
        return 0;
    return ((fact0[n] * fact_[k]) % mod * fact_[n - k]) % mod;
}

int binpow (int a, int n) {
    int res = 1;
    while (n) {
        if (n & 1) {
            res *= a;
            res %= mod;
        }
        a *= a;
        a %= mod;
        n >>= 1;
    }
    return res;
}


int min_cnt(vector<int> a){
    int n = len(a);
    vector<int> tmp(n);
    forn (i, n){
        tmp[a[i]] = i;
    }
    tmp.push_back(-1);
    int ans = 1;
    for (int i = 1; i < n; ++i) {
        int j = a[i - 1], k = a[i];
        if (tmp[j + 1] > tmp[k + 1])
            ++ans;
    }
    return ans;
}


void solve() {
    fact0[0] = 1; forn (i, maxn - 1) fact0[i + 1] = (fact0[i] * (i + 1)) % mod;
    forn (i, maxn) fact_[i] = binpow(fact0[i], mod - 2);

    int n, k; cin >> n >> k;
    vector<int> a(n); forn (i, n) cin >> a[i];
    int val = min_cnt(a);
    int res = 0;
    for (int cnt = val; cnt <= k; ++cnt) {
        res += C(k, cnt) * C(n - val, cnt - val) % mod;
        res %= mod;
    }
    cout << res << endl;

}