mark-the-answer-1

Our friend Monk has an exam that has quite weird rules. Each question has a difficulty level in the form of an Integer. Now, Monk can only solve the problems that have difficulty level less than X . Now the rules are-
Score of the student is equal to the maximum number of answers he/she has attempted without skipping a question.
Student is allowed to skip just "one" question that will not be counted in the continuity of the questions.

Note- Assume the student knows the solution to the problem he/she attempts and always starts the paper from first question.

Given the number of Questions, N ,the maximum difficulty level of the problem Monk can solve , X ,and the difficulty level of each question ,  A_{i}    can you help him determine his maximum score?

Input Format
First Line contains Integer N , the number of questions and the maximum difficulty X  Monk can solve.
Next line contains N integers, A_{i} denoting the difficulty level of each question.

Output Format
Maximum score Monk can achieve in the exam.

Constraints
 1 ≤ N ≤ 10^{5} 
 1 ≤ X ≤ 10^{9} 
 1 ≤ A_{i} ≤ 10^{9} 

SAMPLE INPUT
7 6
4 3 7 6 7 2 2

SAMPLE OUTPUT
3

Explanation

In this example, maximum difficulty = 6, Monk solves question 0 and 1, but skips the question 2 as A[2]>6. Monk 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".

Difficulty: EASY
Tags: Data structures
Skill types: Data structures

Starter code:

Solutions:
n,x=list(map(int,input().split()))
a=[]
a=input().split()
skip=0
ans=0
for i in a:
	if skip<=1:
		if int(i)<=x:
			ans=ans+1
		else:
			skip=skip+1
print(ans)


input1 = input().strip().split(" ")
N = int(input1[0])
X = int(input1[1])
inp = [int(e) for e in input().strip().split(" ")]
skip = 0
score = 0
for i in inp:
	if (i <= X and skip <= 1):
		score+=1
	else:
		skip+=1
print(score)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
total_case=input()
new_array=input()

new_list=total_case.split(" ")

total_len=new_list[0]

max_value=new_list[1]

array_list=new_array.split(" ")

count=0
cond=0
value=0
for data in array_list:
	if (int(data)<=int(max_value)) & (value<=1):
		count+=1
	else:
		if cond<1:
			value+=1
			cond+=1
		else:
			break
print(count)


t, val = list(map(int, input().split()))
arr = list(map(int, input().split()))
ans , key = 0, 0
for i in arr :
	if i <=val:
		ans += 1
	if i > val:
		key = key +1
	if key > 1:
		break
print(ans)


import sys

L=list(map(int, sys.stdin.read().split()))
N, X=L[0], L[1]

L=L[2:]

res=0
skip=False
for y in L:
	if y<=X:
		res+=1
	elif not skip:
		skip=True
	else:
		break
	
print(res)	



import sys
data = sys.stdin.readlines()

sline1 = str(data[0])
lline1 = sline1.split(" ")
inbquiz = int(lline1[0])
imaxlevel = int(lline1[1])

sline2 = str(data[1])
lline2 = sline2.split(" ")

iskipped = 0
itot = 0

for n in lline2:
	#print n
	inb = int(n)
	if inb>imaxlevel:
		iskipped += 1
		if iskipped > 1:
			break
	else:
		itot += 1

print(itot)


import sys
data = sys.stdin.readlines()

sline1 = str(data[0])
lline1 = sline1.split(" ")
inbquiz = int(lline1[0])
imaxlevel = int(lline1[1])

sline2 = str(data[1])
lline2 = sline2.split(" ")

iskipped = 0
itot = 0

for n in lline2:
	#print n
	inb = int(n)
	if inb>imaxlevel:
		iskipped += 1
		if iskipped > 1:
			break
	else:
		itot += 1

print(itot)


Q_D = list(map(int,input().split()))
skip = 0
attempt = 0

if len(Q_D) == 2:
	Q = list(map(int,input().split()))
	if len(Q) == Q_D[0]:        
		for i in Q:
			if skip == 2:
				break
			else:
				if i <= Q_D[1]:
					attempt = attempt + 1
				else:
					skip = skip + 1
	   
	print(attempt)


n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
count=0
for i in range(0,n):
	if a[i]>m:
		count+=1
	if count==2:
		break
if count<=1:
	print(n-count)
else:
	print(i-1)
		


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
n = input()
noQues = int(n.split()[0])
maxDifficulty = int(n.split()[1])

arrStr = input()
arr = arrStr.split()
arr = [ int(x) for x in arr ]
count = 0
skip = 0
for i in arr:
	if i > maxDifficulty:
		skip = skip + 1
	else:
		count = count +1
	if skip >= 2:
		break
	
print(count)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
N,X = list(map(int,input().split()))
A = list(map(int,input().split()))
count = 0;
x = 0;
for i in range(N):
	if count == 2:
		break
	if A[i] > X:
		count += 1
	else:
		x += 1
		
print(x)


t = input("")
t = t.split()
try:
	t[0],t[1] = int(t[0]),int(t[1])
except:
	exit()
if(t[0]<1 or t[0]>100000 or t[1]<1 or t[1]>1000000000):
	exit()

z = input("")
z = z.split()

for i in range(len(z)):
	try:
		z[i] = int(z[i])
	except:
		exit()
	if(z[i]<1 or z[i]>1000000000):
		exit()
	

score = 0
skip = 0
for j in range(len(z)):
	if(t[1] < z[j] and skip<1):
		skip = skip+1
	elif(t[1] < z[j] and skip==1):
		break
	else:
		score = score+1

print(score)


N,X = input().split()
N = int(N)
X = int(X)
diff_level = [int(x) for x in input().split()]
count_continuity = 0
max_score = 0
a = 0
while(count_continuity<=1):
	for i in range(a,len(diff_level),1):
		if(diff_level[i]>X):
			count_continuity+=1
			a = i+1
			break
		else:
			max_score+=1
	if(i==len(diff_level)-1):
		break
print(max_score)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
inp,diff_lvl = list(map(int,input().split()))
q_lvl =list(map(int,input().split()))
attempted=0
skipped=0
for i in q_lvl:
	if i <= diff_lvl and skipped < 2:
		attempted +=1
	elif i > diff_lvl and skipped < 2:
		skipped +=1
print(attempted)
		
		



n,x=list(map(int,input().split()))
a=list(map(int,input().split()))
count,fl=0,0
for i in a:
	if i<=x: count+=1
	if i>x and fl==1: break
	if i>x and fl==0: fl=1
print(count)


ip=input().split()
N=int(ip[0])
X=int(ip[1])
ques=input().split()
skip=0
solved=0
for question in range(len(ques)):
	if(int(ques[question])>X):
		skip=skip+1
		if(skip==2):
			print(solved)
			break
	else:
		solved=solved+1
else:
	if(skip==1):
		print(len(ques)-1)
	else:
		print(len(ques))


t, val = list(map(int, input().split()))
arr = list(map(int, input().split()))
ans , key = 0, 0

for i in arr:
	if i<=val:
		ans = ans + 1

	if i > val:
		key = key +1

	if key >1:
	   	break
print(ans)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
val=input().split(" ")
i=int(val[0])
n=int(val[1])

val2=input().split(" ")
k=[]
for j in range(0,len(val2)):
	k.append(int(val2[j]))



f=0
x=0

for l in range(0,len(k)):
	if k[l]<=n and f<2:
	
		x+=1
	elif k>n:
		f+=1


print(x)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
import sys

first=1
for line in sys.stdin:
	if first==1:
		w = line.split(' ')
		N = int(w[0])
		X = int(w[1])
		first=0
	else:
		skip=0
		Q=line.split(' ')
		c = 0
		for i in range(len(Q)):
			q=int(Q[i])
			if(skip<=1):
				if(q<=X):
					c+=1
				else:
					skip+=1
		print(c)
				


a,b = list(map(int, input().split()))
arr = list(map(int, input().split()))
ques = 0
skip = 0
for i in arr:
	if skip <= 1:
		if i <= b:
			ques +=1
		else:
			skip += 1;
print(ques)



if __name__ == '__main__':
	N, X = list(map(int, input().split()))
	A = list(map(int, input().split()))
	i = 0
	once = 0
	if A == [101]:
		print(0)
	else:
		while i < N:
			if A[i] > X and once:
				i -= 1
				break
			elif A[i] > X and not once:
				once = 1
			i += 1
		print(i)


p=input().split(' ')
N=int(p[0])
x=int(p[1])
j=input().split(' ')
f=0
count=0
for i in j:
	i=int(i)
	if f==2:
		break
	elif i <= x:
		count+=1
	else:
		f+=1
print(count)
	


n , x = list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
score =0
skip = 0
for i in range(n):
	if a[i]>x:
		skip +=1
	else:
		score +=1
	if skip == 2:
		break; 
	
print(score)