Mishka and Contest

TimeLimit:1000MS  MemoryLimit:256MB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description

Mishka started participating in a programming contest. There are n problems in the contest. Mishka's problem-solving skill is equal to k.

Mishka arranges all problems from the contest into a list. Because of his weird principles, Mishka only solves problems from one of the ends of the list. Every time, he chooses which end (left or right) he will solve the next problem from. Thus, each problem Mishka solves is either the leftmost or the rightmost problem in the list.

Mishka cannot solve a problem with difficulty greater than k. When Mishka solves the problem, it disappears from the list, so the length of the list decreases by 1. Mishka stops when he is unable to solve any problem from any end of the list.

How many problems can Mishka solve?

Input

The first line of input contains two integers n and k (1<=n, k<=100) — the number of problems in the contest and Mishka's problem-solving skill.

The second line of input contains n integers a_1, a_2, ..., a_n (1<=a_i<=100), where a_i is the difficulty of the i-th problem. The problems are given in order from the leftmost to the rightmost in the list.

Output

Print one integer — the maximum number of problems Mishka can solve.

SampleInput 1
8 4
4 2 3 1 5 1 6 4
SampleOutput 1
5
SampleInput 2
5 2
3 1 2 1 3
SampleOutput 2
0
SampleInput 3
5 100
12 34 55 43 21
SampleOutput 3
5
Note

In the first example, Mishka can solve problems in the following order: [4, 2, 3, 1, 5, 1, 6, 4] → [2, 3, 1, 5, 1, 6, 4] → [2, 3, 1, 5, 1, 6] → [3, 1, 5, 1, 6] → [1, 5, 1, 6] → [5, 1, 6], so the number of solved problems will be equal to 5.

In the second example, Mishka can't solve any problem because the difficulties of problems from both ends are greater than k.

In the third example, Mishka's solving skill is so amazing that he can solve all the problems.

Submit
题目统计信息详细
总AC数23
通过人数21
尝试人数21
总提交量26
AC率80.77%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: