INCSEQ  Increasing Subsequences
Given a sequence of N (1 ≤ N ≤ 10,000) integers S_{1}, ..., S_{N} (0 ≤ S_{i} < 100,000), compute the number of increasing subsequences of S with length K (1 ≤ K ≤ 50 and K ≤ N); that is, the number of Ktuples i_{1}, ..., i_{K} such that 1 ≤ i_{1} < ... < i_{K} ≤ N and S_{i1} < ... < S_{iK}.
Input
The first line contains the two integers N and K. The following N lines contain the integers of the sequence in order.
Output
Print a single integer representing the number of increasing subsequences of S of length K, modulo 5,000,000.
Example
Input: 4 3 1 2 2 10 Output: 2
The two 3tuples are (1, 2, 4) and (1, 3, 4), both corresponding to the subsequence 1, 2, 10.
hide comments
ulasuevoli:
20120110 12:02:29
My code fails for


Pranay:
20111218 16:43:52
can try ELDORADO in tutorial.. 

Vlade087:
20110902 15:28:21
anybody can give me some testdata Last edit: 20110902 17:16:16 

aayush:
20110804 17:50:35
DP???


Fahim Zubayer:
20110514 02:35:50
DO REMEMBER to handle the zero :( Cost me a lot of TLE's 

Nikhil Garg:
20100520 11:52:41
INCDSEQ is a similar problem. 
Added by:  Neal Wu 
Date:  20080620 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ERL JSRHINO 
Resource: 