#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define endl "\n"
#endif
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> PII;

const int mod = 998244353;
int pomod(int x, int y) {
    int res = 1;
    while (y) {
        if (y & 1) res = 1ll * res * x % mod;
        y >>= 1;
        x = 1ll * x * x % mod;
    }
    return res;
}

const int N = 4e5 + 10;
int fact[N];
int invfact[N];

int ncr(int x, int y) {
    return 1ll * fact[x] * invfact[x - y] % mod * invfact[y] % mod;
}

void solve() {
    fact[0] = invfact[0] = 1;
    for (int i = 1; i < N; i++)
        fact[i] = 1ll * fact[i - 1] * i % mod;
    for (int i = 1; i < N; i++)
        invfact[i] = pomod(fact[i], mod - 2);
    int n, k; cin >> n >> k;

    VI suf(n); for (auto &x : suf) cin >> x;
    suf.insert(suf.begin(), n); // the last empty suffix

    VI suf_order(n + 1);
    for (int i = 0; i <= n; i++)
        suf_order[suf[i]] = i;

    int assigned = 1;
    for (int i = 2; i <= n; i++) {
        int x = suf[i - 1];
        int y = suf[i - 0];

        // at this point, i can have s_x == s_y OR s_x < s_y
        // s_x == s_y can only happen when I am guaranteed that
        // suffix[x + 1] is smaller than suffix[y + 1]
        if (suf_order[x + 1] < suf_order[y + 1]) {
        } else {
            assigned++;
        }
    }

    if (assigned > k) {
        cout << 0 << endl;
        return;
    }

    int left = k - assigned;
    int ans = ncr(left + n, left); 
    cout << ans << endl;
}

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