One day Mirko, while he was walking through the high grass, stumbled upon a
sequence of colored marbles. Soon he noticed that if he touches
or more
consecutive marbles of the same color, they start to twinkle and then he
could wish them to magically vanish, although he doesn't have to do that
immediately (see Sample Input 3). Fortunately, Mirko brought an inexhaustible
supply of marbles from home, so he can insert a marble of any color
anywhere in the array (at the beginning, between any two existing marbles,
or at the end). Help Mirko find the smallest number of marbles he must insert
into the sequence before he could make all of the marbles vanish.
Input Specification
The first line of input contains two integers
and
- the number of marbles in the initial sequence and the minimal number
of consecutive marbles of the same color he could wish to vanish.
The next line contains exactly integers between
and
(inclusive),
separated by one space. Those numbers represent colors of marbles in the
sequence Mirko found.
Output Specification
The output should contain only one line with a single integer number - the minimal number of marbles Mirko has to insert to achieve the desired effect.
Sample Input 1
2 5
1 1
Sample Output 1
3
Sample Input 2
5 3
2 2 3 2 2
Sample Output 2
2
Sample Input 3
10 4
3 3 3 3 2 3 1 1 1 3
Sample Output 3
4
Comments