#Q0008. 递增子序列

递增子序列

Problem Description

A numeric sequence of ai is ordered if a1<a2<……<aN. Let the subsequence of the given numeric sequence (a1, a2,……, aN) be any sequence (ai1, ai2,……, aiK), where 1<=i1<i2 <……<iK<=N. For example, sequence (1, 7, 3, 5, 9, 4, 8) has ordered subsequences, eg. (1, 7), (3, 4, 8) and many others.

Your program, when given the numeric sequence, must find the number of its ordered subsequence with exact m numbers. 给出一行n个数字,问长度为m的严格上升子序列有多少个?

Input

The first line contains two integers n and m, n is the length of the sequence and m represent the size of the subsequence you need to find. The second line contains the elements of sequence - n integers in the range from 0 to 987654321 each. Process to the end of file. [Technical Specification] 1<=n<=10000 1<=m<=100

Output

For each case, output answer % 123456789.

Sample Input

7 3
1 7 3 5 9 4 8

Sample Output

12
3 2
1 1 2
2