#P11616. Strictly Increasing Segments Partition

    ID: 13710 Type: Default 1000ms 256MiB

Strictly Increasing Segments Partition

Strictly Increasing Segments Partition

You are given an array \(a\) of length \(n\). You need to partition it into no more than \(m\) non-empty contiguous segments in such a way that the numbers in each segment are in strictly increasing order. Find the number of ways to partition the array under these conditions. Since the answer may be very large, output it modulo \(998244353\).

Note: A valid partition splits the array into one or more segments (at most \(m\) segments). Each segment \(a_{l}, a_{l+1}, \dots, a_{r}\) must satisfy \(a_l < a_{l+1} < \cdots < a_r\).

inputFormat

The first line contains two integers \(n\) and \(m\) \((1 \leq n \leq 10^5, 1 \leq m \leq n)\) — the length of the array and the maximum number of segments allowed, respectively.

The second line contains \(n\) integers \(a_1, a_2, \dots, a_n\) \((1 \leq a_i \leq 10^9)\) representing the array elements.

outputFormat

Output a single integer — the number of ways to partition the array into at most \(m\) segments, with each segment being strictly increasing, modulo \(998244353\).

sample

4 2
1 2 3 4
4