View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 256M

Author:
Problem types

You just got a multi-million dollar contract to operate radar infrastructure.

Each radar outputs data points it has collected while rotating in a circle. Each data point consists of a value . You are to find the longest consecutive sequence of data points that has a value strictly less than .

Notice points and are considered consecutive since it wraps around!

#### Input Specification

The first line contains the integers and , representing the number of data points, and the condition specified above.

On the next line, there are space-separated numbers

#### Output Specification

On a single line, output the longest sequence length. If no sequence exists, output 0.

#### Sample Input

5 3
1 3 5 2 2

#### Sample Output

3

#### Explanation

In this example, the longest sequence wraps around and consists of the numbers 2 2 1 going from right to left.