Contemporary Art#5990

Contemporary Art

3 секунде
512 мегабајтова
Средње

If you have ever visited the contemporary art exhibition "Arsenal," you know the immense cultural value of its displays. Not wanting to be outdone by the capital, Odesa, with the help of its residents, has created its own masterpiece of contemporary art: a sequence of towers made entirely from coffee cups!

This exhibit consists of towers of various heights, arranged consecutively along the main street. However, some vandals—who neither appreciate art nor possess a sense of beauty (and happen to be competitive programmers)—decided to have a coffee spree at night, using cups. As a result, the heights of some towers were altered. Now, the height of the -th tower is A_i. The towers need to be urgently restored so that the beauty of the resulting display is maximized.

The beauty of this masterpiece is defined as the length of the longest beautiful sequence of towers. A sequence of towers from to (1 \le l \le r \le n) is considered beautiful if H_l = H_{l+1} = \dots = H_r, where H_i denotes the height of the -th tower after adding cups.

Originally, the task was given to Odesa's most diligent girls, but since they went off to school, the challenge has been passed to you: output the maximum possible beauty of the towers that can be achieved by adding at most cups. Note that you cannot create new towers or remove cups.

Улаз

The first line contains two integers (1 \le n \le 10^6) and (0 \le m \le 10^9). The second line contains integers A_1, A_2, \dots, A_n (1 \le A_i \le 10^9), where A_i is the current height of the -th tower.

Излаз

Output a single integer: the maximum beauty of the exhibit that can be achieved.

Примери

Пример 1

Loading
Loading