As we know, the art of splitting workers to separate mineral patches is a tricky one.
There are mineral patches in order, each has minerals to be mined. Our StarCraft player will split drones to mine contiguous mineral patches.
The StarCraft player notes that for some values of , over the ways to send drones to mine minerals, the sequence of values corresponding to the mineral patches being mined is the same.
The StarCraft player wishes to find the maximum such that some sequence of length appears at least times among the possible sequences of values that can be mined.
Constraints
Input Specification
The first line will contain two space-separated integers, and .
Each of the next lines will contain an integer, the in order.
Output Specification
Output the maximum . The input data guarantee that is positive.
Sample Input
8 2
1
2
3
2
3
2
3
1
Sample Output
4
Comments