Time limit: 0.6s
Memory limit: 128MB
Input:
Output:
Bun - Sun Tzu
Task
On his daily walking trip to , Ion Mergătorul got bored of tripping over rocks so he tripped over an array with integers and positive integer . A subarray is called suntzu if every element in the subarray appears at least times in the subarray. Ion wants to know how many suntzu subarrays are there in the array.
Input data
The first line of the input containts two integers and --- the size of the array and the positive integer .
The second line contains integers --- the elements of the array.
Output data
The output should contain a single integer --- the number of suntzu subarrays in the array.
Constraints and clarifications
- for all
- At Prosoft @ NT competition, the subtasks were worth points. The problem was configured using the IIOT score distribution for extra challenge.
| # | Score | Constraints |
|---|---|---|
| 1 | 2 | |
| 2 | 17 | |
| 3 | 13 | |
| 4 | 14 | |
| 5 | 54 | No additional restrictions |
Example
stdin
6 2
1 2 2 1 2 1
stdout
6
Explanation
The suntzu arrays are as follows: , , , , ,