#CCBCHBAHAI0000160. Phần tử cuối cùng nhỏ hơn x (Last Element Less Than x)
Phần tử cuối cùng nhỏ hơn x (Last Element Less Than x)
Last Element Less Than x
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given an integer array and an integer , find the largest -based index such that
If no element is less than , print -1.
Input
- The first line contains integers and .
- The second line contains integers .
Output
Print the last index whose value is less than , or -1 if none exists.
Subtasks
Subtask 1 (100 points): ; .
Examples
Input
7 5
2 8 4 7 5 1 9
Output
5
Explanation
Values below occur at indices . The largest matching index is .