6187: 部分排序

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:1 Solved:1

Description

个数列 P 中有 n 个数。小蓝从中选择位置连续的 k 个数,并对这 k 个数进行升序排列。求排序
后的数列有多少种?

Input

n k
P
0 P1 Pn-1
其中:所有的输入都是整数, 2n100, 2kn, 0Pi≤n-1, P0,P1,,Pn-1 数值都不相同。

Output

部分排序后数列的排列数。

Sample Input Copy

5 3
0 2 1 4 3

Sample Output Copy

2

HINT

从原数列抽取连续 3 个数排序后有 2 种可能性: (0,1,2,4,3) 和 (0,2,1,3,4)。