#pragma GCC optimize("Ofast")

#include <iostream>
#include <fstream>
#include <algorithm>
#include <functional>
#include <array>
#include <chrono>
#include <random>
#include <vector>
#include <string>
#include <sstream>
#include <cmath>
#include <cstring>
#include <bitset>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cassert>

#define sq(x) ((x) * (x))
#define err(x) cerr << "["#x"]  " << (x) << "\n";
#define errp(x) cerr << "["#x"]  {" << ((x).first) << ", " << ((x).second) << "}\n";
#define errv(x) {cerr << "["#x"]  [";for(const auto& ___ : (x)) cerr << ___ << ", "; cerr << "]\n";}
#define errvn(x, n) {cerr << "["#x"]  [";for(auto ___ = 0; ___ < (n); ++___) cerr << (x)[___] << ", "; cerr << "]\n";}
#define errf() cerr << "\n\n";

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll getrnd(ll l, ll r) {
    return uniform_int_distribution<ll>(l, r)(rng);
}

template <typename T1, typename T2> inline bool relax(T1& a, const T2& b) {
    return a > b ? a = b, true : false;
}

template <typename T1, typename T2> inline bool strain(T1& a, const T2& b) {
    return a < b ? a = b, true : false;
}

// :::::::::::::::::::::::::::::::

const int MOD = 998244353;

int add(int a, int b) {
    a += b;
    if (a >= MOD) a -= MOD;
    if (a < 0) a += MOD;
    return a;
}

int mul(int a, int b) {
    return 1LL * a * b % MOD;
}

int binpow(int a, ll n) {
    if (n < 0)
        a = binpow(a, MOD - 2), n *= -1;
    
    int res = 1;
    while (n) {
        if (n & 1)
            res = mul(res, a);
        a = mul(a, a);
        n /= 2;
    }
    return res;
}

int inv(int x) {
    return binpow(x, MOD - 2);
}

const int N = 5e5 + 3;

int fact[N], ifact[N];

int C(int n, int k) {
    if (k > n) return 0;
    return mul(fact[n], mul(ifact[k], ifact[n - k]));
}

int Crep(int n, int k) {
    return C(n + k - 1, k);
}

void solve() {
    fact[0] = ifact[0] = 1;
    for (int i = 1; i < N; ++i)
        fact[i] = mul(fact[i - 1], i);
    ifact[N - 1] = inv(fact[N - 1]);
    for (int i = N - 2; i >= 0; --i)
        ifact[i] = mul(ifact[i + 1], i + 1);
    
    int n, k;
    cin >> n >> k;
    
    vector<int> p(n), wh(n + 1);
    for (int i = 0; i < n; ++i)
        cin >> p[i], wh[p[i]] = i;
    wh[n] = -1;
    
    int up = 0;
    for (int i = 1; i < n; ++i) {
        if (wh[p[i] + 1] < wh[p[i - 1] + 1])
            ++up;
    }
    
    int ans = 0;
    for (int i = 0; i < k - up; ++i)
        ans = add(ans, Crep(n, i));
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
    
    int t = 1;
//    cin >> t;
    while (t--)
        solve();
    
    return 0;
}
