5977: Cow Lineup

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:10 Solved:1

Description

农夫约翰的N(1 ≤ N ≤ 100,000)只奶牛排成了一队,每只牛都用编上了一个“血统编号”,该编号为范围0...1,000,000,000的整数。血统相同的奶牛有相同的编号,也就是可能有多头奶牛是相同的"血统编号"。
约翰觉得如果连续排列的一段奶牛有相同的血统编号的话,奶牛们看起来会更具有威猛。为了创造这样的连续段,约翰最多能选出k种血统的奶牛,并把他们全部从队列中赶走。
请帮助约翰计算这样做能得到的由相同血统编号的牛构成的连续段的长度最大是多少?

Input

第一行两个整数N,K
接下来N行,每行1个整数,表示奶牛的血统编号

Output

一行一个整数表示答案

Sample Input Copy

9 1
2
7
3
7
7
3
7
5
7

Sample Output Copy

4

HINT

There are 9 cows in the lineup, with breed IDs 2, 7, 3, 7, 7, 3, 7, 5, 7. FJ would like to remove up to 1 breed ID from this lineup.
By removing all cows with breed ID 3, the lineup reduces to 2, 7, 7, 7, 7, 5, 7. In this new lineup, there is a contiguous block of 4 cows with the same breed ID (7).