AdvancedRating 1800
Blocks With Exactly k Different Values
Count the blocks of consecutive numbers that contain exactly k different values.
Input
n and k, then n integers.
Output
One integer.
Sample 1
Input
5 2 1 2 1 2 3
Output
7
Sample 2
Input
5 3 1 2 1 3 4
Output
3
Output appears here