professor-angry-3

The professor is conducting a course on Discrete Mathematics to a class of N students. He is angry at the lack of their discipline, and he decides to cancel the class if there are fewer than K students present after the class starts.

Given the arrival time of each student, your task is to find out if the class gets cancelled or not.

INPUT

The first line of the input contains T, the number of test cases. Each test case contains two lines.
The first line of each test case contains two space-separated integers, N and K.
The next line contains N space-separated integers, a1,a2,…,aN, representing the arrival time of each student.

If the arrival time of a given student is a non-positive integer (ai≤0), then the student enters before the class starts. If the arrival time of a given student is a positive integer (ai>0), the student enters after the class has started.

OUTPUT

For each testcase, print "YES" (without quotes) if the class gets cancelled and "NO" (without quotes) otherwise. 

CONSTRAINT

1≤T≤10

1≤N≤1000

1≤N≤

−100≤ai≤100,where i∈[1,N]

NOTE

If a student enters the class exactly when it starts (ai=0), the student is considered to have entered before the class has started.

SAMPLE INPUT
2
4 3
-1 -3 4 2
4 2
0 -1 2 1

SAMPLE OUTPUT
YES
NO

Explanation

For the first test case, K=3, i.e., the professor wants at least 3 students to be in class but there are only 2 who have arrived on time (−3 and −1), hence the class gets cancelled.

For the second test case, K=2, i.e, the professor wants at least 2 students to be in class and there are 2 who have arrived on time (0 and −1), hence the class does not get cancelled.

Difficulty: UNKNOWN_DIFFICULTY

Starter code:

Solutions:
test_cases=int(input())
for i in range(test_cases):
	students,required=input().split()
	students=int(students)
	required=int(required)
	a=[0]*students
	a=input().split()
	count=0
	for i in range(students):
		a[i]=int(a[i])
		if a[i]<=0:
			count+=1
	if count>=required:
		print("NO")
	else:
		print("YES")


from sys import stdin
nextint = iter(map(int, stdin.read().split())).__next__
for _ in range(nextint()):
	n, k = nextint(), nextint()
	print(['YES', 'NO'][
		len([x for x in [nextint() for _ in range(n)] if x <= 0]) >= k
	])


'''
# 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!'

t = eval(input())

while t:
	N,K = list(map(int,input().split(" ")))

	ar = list(map(int,input().split(" ")))
	
	
	count = 0
	flag = 0
	for x in ar:
		if x <= 0:
			count +=1
		if count >= K:
			print("NO")
			flag = 1
			break
	
	if not flag:
		print("YES")
	
	t -=1




t = int(input())
for i in range(t):
	n, k = list(map(int, input().split()))
	a = list(map(int, input().split()))
	l = 0
	for i in a:
		if i <= 0:
			l+=1
	if k > l:
		print('YES')
	else:
		print('NO')


t = int(input())
while(t):
	cnt = 0
	n,k=list(map(int,input().split()))
	lis = list(map(int,input().split()))
	for i in lis:
		if(i<=0):
			cnt+=1
	if(cnt>=k):
		print ("NO")
	else:
		print("YES")
	t-=1


tc=int(input())
for i in range(tc):
	stu,sir=list(map(int,input().split()))
	a=[]
	a=list(map(int,input().split()))
	count=0
	for k in a:
		if k<=0:
		   count+=1
	if count>=sir:
		print("NO")
	else:
		print("YES")
		


T=eval(input())
for i in range(T):
	a,b=list(map(int,input().split()))
	c=list(map(int,input().split()))
	count=0
	for j in c:
		if j<=0:
			count+=1
	if count>=b:
		print("NO")
	else:
		print("YES")



n=int(input())
for j in range(n):
	n,k=list(map(int,input().split()))
	s=list(map(int,input().split()))
	count=0
	for i in range(len(s)):
		if s[i]<=0:
			count+=1
	if count>=k:
		print("NO")
	else:
		print("YES")


for i in range(eval(input())):
	n , k = list(map(int,input().split()))
	list = list(map(int,input().split()))
	for x in list:
		if x <= 0:
			k -= 1
	if k > 0:
		print("YES")
	else:
		print("NO")


for t in range(eval(input())):
	n = input().split()
	N = int(n[0])
	K = int(n[1])
	li = input().split()
	count = 0
	for x in li:
		if int(x) <= 0:
			count += 1
	if count >= K:
		print("NO")
	else:
		print("YES")


for i in range(eval(input())):
	n,k=list(map(int,input().split(" ")))
	stud=list(map(int,input().split(" ")))
	c=0
	for i in stud:
		if i<=0:
			c=c+1
		else:
			c=c
	if c<k:
		print("YES")
		
	else:
		print("NO")


t=int(input())
for i in range(t):
	n,k=list(map(int,input().split()))
	l=[int(x) for x in input().split()]
	count=0
	flag=0
	for j in l:
		if count>=k:
			flag=1
			break
		if j<=0:
			count+=1
	if flag==1:
		print("NO")
	else:
		print("YES")
		#print count


t = int(input())

res_list = []
while t > 0:
	count = 0
	n,k = list(map(int,input().split()))
	stu = list(map(int,input().split()))
	for i in stu:
		if i <= 0:
			count += 1
	if count >= k:
		res_list.append('NO')
	else:
		res_list.append('YES')
	t -= 1
for res in res_list:
	print(res)


t=eval(input())
for _ in range (t):
	n,k=list(map(int,input().split()))
	a=list(map(int,input().split()))
	a=sorted(a)
	c=0
	i=0
	while a[i]<=0:
		c+=1
		i+=1
	if c>=k:
		print('NO')
	else:
		print('YES')


t=eval(input())
for i in range(t):
	su=0
	n,k=list(map(int,input().split()))
	a=list(map(int,input().split()))
	for j in range(len(a)):
		if a[j]<=0:
			su+=1
	if su<k:
		print("YES")
	else: 
		print("NO")


for _ in range(0,eval(input())):
	n,k=list(map(int,input().split()))
	case=list(map(int,input().split()))
	t=0
	for x in range(0,n):
		if case[x]<=0:
			t+=1
	if t>=k:
		print('NO')
	else:
		print('YES')