Cookie row


Submit solution

Points: 100 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

After all the lectures, k lecturers decided to go taste some cookies. Khust's lecturers love to eat cookies, especially when they want to relax.

There are n cookies in a row. Each cookie is one of 109 kinds. Lecturers will take only k consecutive cookies of the same kind. After every lecturer got his cookie, those k cookies disappear from the row. They will eat cookies until there's at least one way to choose k consecutive cookies of the same kind.

Count the number of cookies that one of the lecturers will eat.

Input Specification

First line contains two integers n and k (1kn106) --- the number of cookies and the number of lecturers.

The second line contains n integers Ai (1Ai109) --- kind of the i-th cookie.

Output Specification

Print one number --- the number of cookies that one of the lecturers will eat.

Sample Input 1

Copy
10 3
1 1 2 3 3 3 2 2 1 1

Sample Output 1

Copy
3

Note

Initially, there are 10 cookies and 3 lecturers. 1 1 2 3 3 3 2 2 1 1

Each of the lecturers will take cookies of the third type, and then there will be 7 cookies left. 1 1 2 2 2 1 1

After another step, there will be 4 cookies left. 1 1 1 1

And in the end, there is only one cookie. 1

So, each lecturer ate 3 cookies.


Comments

There are no comments at the moment.