First Element Greater Than Or Equal To KEasy

First Element Greater Than Or Equal To K

EasyPractice library · +10 XPbinary searchsorted arrayslower bound

You are given a sorted array of N distinct integers. Your task is to find the index of the first element in the array that is greater than or equal to a given integer K. If no such element exists, output -1.

Array indices are 1-based.

Input

The first line contains two integers N and K, separated by a space. The second line contains N distinct integers, sorted in non-decreasing order, representing the array elements.

Output

Print a single integer: the 1-based index of the first element greater than or equal to K, or -1 if no such element exists.

Constraints

1 <= N <= 1000 -10^9 <= K <= 10^9 Array elements are distinct and sorted in non-decreasing order. -10^9 <= array element <= 10^9

Time limit 1 s (native code; slower languages get more)Memory 256 MB15 hidden tests

Example 1

Input
5 7
2 3 5 7 9
Output
4

The first element >= 7 is 7, which is at index 4.

Example 2

Input
6 10
1 3 5 8 9 12
Output
6

The first element >= 10 is 12, which is at index 6.

Hints