#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define sc second
#define pb push_back
#define ll long long
#define trav(v,x) for(auto v:x)
using namespace std;
const int N = 1e6 + 100;
const ll mod = 998244353;

int n, m, need;
int sa[N], rnk[N];
ll fac[N], ifac[N];

ll C(ll x, ll y)
{return 1LL * fac[x] * ifac[y] % mod * ifac[x - y] % mod;}

ll qpow(ll x, ll y = mod - 2)
{
    ll res = 1;
    while(y)
    {
        if(y & 1)res = res * x % mod;
        x = x * x % mod, y >>= 1;
    }
    return res;
}

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
        cin >> sa[i], ++sa[i], rnk[sa[i]] = i;
    need = 1;
    sa[n + 1] = 0;
    for(int i = 2; i <= n; i++)
    {
        int bf_ps = sa[i - 1], nw_ps = sa[i];
        if(rnk[bf_ps + 1] < rnk[nw_ps + 1]);
        else ++need;
    }
    m -= need;
 //   cerr <<"!!" << m << '\n';
    ll ans = 0;
    fac[0] = 1;
    for(int i = 1; i < N; i++)fac[i] = fac[i - 1] * i % mod;
    ifac[N - 1] = qpow(fac[N - 1]);
    for(int i = N - 2; i >= 0; i--)ifac[i] = ifac[i + 1] * (i + 1) % mod;
    for(ll x = 0; x <= m; x++)
        ans = (ans + C(x + n - 1, n - 1)) % mod;
    cout << ans  << '\n';
	return 0;
}
