2608.Subsequences

Time Limit: 1s Memory Limit: 256MB

For the given sequence with n different elements find the number of increasing subsequences with k+1 elements. It is guaranteed that the answer is not greater than 8 \cdot 1018.

Input Format(From the terminal/stdin)

First line contain two integer values n and k (1 \le n \le 105,0 \le k \le 10) - the length of sequence and the number of elements in increasing subsequences.

Next n lines contains one integer ai (1 \le ai \le n) each - elements of sequence. All values ai are different.

Output Format(To the terminal/stdout)

Print one integer - the answer to the problem.

Sample Input

Copy
5 2
1
2
3
5
4
 · \n
 \n
 \n
 \n
 \n
 \n

Sample Output

Copy
7
 \n

Submit

请先 登录

© 2025 FAQs