Matthews Score

0

0 votes
Easy
Problem

Matthew has to give an examination that has some weird rules.Each question has a difficulty level given in the the form of an Integer. Matthew can only solve the questions that have difficulty level less than or equal to a number X. The rules are:

    • Score of the students is equal to the maximum number of answers he/she has attempted without skipping a question.
    • A Student is allowed to skip only “one" question that will not be counted in the continuity of questions.

Note - The student always knows the answer to the question he or she attempts and always starts from the first question of the paper. The order of the questions in given in the array.
Given the number of Questions N ,the maximum difficulty level of the problem Matthew can solve X ,and the difficulty level of each question i is Ai (in the array) can you help him find out what his maximum score would be?
Input Format
First Line contains Integer N, the number of questions and the maximum difficulty X Matthew can solve.
Next line contains N integers, Ai denoting the difficulty level of each question.
Output Format
A single integer showing the number of questions Matthew can solve.
Constraints
1N105
1X109
1Ai109
Sample Input
7 6
4 3 7 6 7 2 2
Sample Output
3
Explanation
In this example, maximum difficulty = 6, Matthew solves question 0 and 1, but skips the question 2 as A[2] > 6. Matthew then solves the question 3 , but stops at 4 because A[4] > 6 and question 2 was already skipped. As 3 questions (0,1 and 3) were solved and 2 questions (2 and 4) have been skipped, therefore we print "3".

Time Limit: 2
Memory Limit: 256
Source Limit:
Editor Image

?