## Mock CCO '18 Contest 4 Problem 6 - Splitting Drones

View as PDF

Points: 15 (partial)
Time limit: 0.5s
Memory limit: 64M

Problem type

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 players 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.

#### Input Specification

The first line will contain two space-separated integers, and .

Each of the next lines contains 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