#K66462. Sequentially Solvable Problems

    ID: 32426 Type: Default 1000ms 256MiB

Sequentially Solvable Problems

Sequentially Solvable Problems

In this problem, the team is given a sequence of problems with various difficulty levels. The team can solve problems one after another until they encounter a problem with a difficulty level strictly greater than a given threshold \(D\). Your task is to determine the number of sequential problems that can be solved without interruption.

Input: The first line contains two integers \(N\) and \(D\), where \(N\) is the number of problems and \(D\) is the maximum allowable difficulty. The second line contains \(N\) space-separated integers representing the difficulty levels of the problems.

Output: Output a single integer representing the count of problems that can be solved in order before encountering a problem with difficulty exceeding \(D\).

inputFormat

The input is read from stdin and consists of two lines:

  • The first line contains two integers (N) and (D): the number of problems and the maximum difficulty allowed, respectively.
  • The second line contains (N) space-separated integers representing the difficulty levels of the problems.

outputFormat

The output, printed to stdout, is a single integer representing the number of problems that can be solved consecutively before a problem with difficulty greater than (D) is encountered.## sample

5 75
10 20 75 80 60
3