A Discrete Mathematics professor has a class of students. Frustrated with their lack of discipline, the professor decides to cancel class if fewer than some number of students are present when class starts.  Arrival times go from on time ($arrivalTime\leq0$) to arrived late ($arrivalTime>0$).

Given the arrival time of each student and a threshhold number of attendees, determine if the class is cancelled.  

Example  

$n=5$ 

$k=3$ 

$a=[-2,-1,0,1,2]$  

The first $3$ students arrived on.  The last $2$ were late.  The threshold is $3$ students, so class will go on.  Return YES.   

Note: Non-positive arrival times ($a[i]\leq0$) indicate the student arrived early or on time; positive arrival times ($a[i]>0$) indicate the student arrived $a[i]$ minutes late.  

Function Description

Complete the angryProfessor function in the editor below.  It must return YES if class is cancelled, or NO otherwise.  

angryProfessor has the following parameter(s):  

int k: the threshold number of students  
int a[n]: the arrival times of the $n$ students

Returns  

string:  either YES or NO

Input Format

The first line of input contains $\boldsymbol{\boldsymbol{t}}$, the number of test cases. 

Each test case consists of two lines.  

The first line has two space-separated integers, $n$ and $\boldsymbol{\mbox{k}}$, the number of students (size of $a$) and the cancellation threshold. 

The second line contains $n$ space-separated integers ($a[1],a[2],...,a[n]$) that describe the arrival times for each student.

Constraints

$1\leq t\leq10$  
$1\leq n\leq1000$  
$1\leq k\leq n$  
$-100\leq a[i]\leq100,where\ i\in[1,\ldots n]$

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$. The professor wants at least $3$ students in attendance, but only $2$ have arrived on time (${-3}$ and $-1$) so the class is cancelled.

For the second test case, $k=2$. The professor wants at least $2$ students in attendance, and there are $2$ who arrived on time ($0$ and $-1$).  The class is not cancelled.

Source: hackerrank | Difficulty: EASY
Tags: Implementation


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


t = int(input())
for tests in range(t):
	(n, k) = [int(x) for x in input().split()]
	s = 0
	for x in input().split():
		y = int(x)
		if y <= 0:
			s += 1
	if s < k:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	(N, K) = map(int, input().split())
	time = map(int, input().split())
	ontime = len([t for t in time if t <= 0])
	if ontime >= K:
		print('NO')
	else:
		print('YES')


for _ in range(int(input().strip())):
	(n, k) = map(int, input().strip().split())
	arrivals_at_time = 0
	for a in map(int, input().strip().split()):
		if a <= 0:
			arrivals_at_time += 1
	print('YES' if arrivals_at_time < k else 'NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	count = 0
	cl = False
	for i in a:
		if i <= 0:
			count += 1
			if count == k:
				cl = True
				break
	if not cl:
		print('YES')
	else:
		print('NO')


T = int(input().strip())
for _ in range(T):
	(N, K) = map(int, input().strip().split())
	students = map(int, input().strip().split())
	for s in students:
		if s <= 0:
			K -= 1
	if K <= 0:
		print('NO')
	else:
		print('YES')


T = int(input())
for i in range(T):
	NK = input().split(' ')
	N = int(NK[0])
	K = int(NK[1])
	times = input().split(' ')
	count = 0
	for t in times:
		if int(t) <= 0:
			count += 1
	if count < K:
		print('YES')
	else:
		print('NO')


def enough_positive(arr, k):
	pos = 0
	sum([])
for _ in range(int(input())):
	(n, k) = [int(s) for s in input().split()]
	present = [int(s) <= 0 for s in input().split()]
	print('YES' if sum(present) < k else 'NO')


def read_numbers():
	return [int(i) for i in input().split(' ')]
t = int(input())
for i in range(t):
	(n, k) = read_numbers()
	arrivals = read_numbers()
	actual = 0
	for t in arrivals:
		if t <= 0:
			actual += 1
		if actual >= k:
			break
	if actual >= k:
		print('NO')
	else:
		print('YES')


t = int(input())
for x in range(t):
	i = input().split(' ')
	N = int(i[0])
	K = int(i[1])
	j = input().split(' ')
	count = 0
	for k in j:
		if int(k) <= 0:
			count += 1
	if count < K:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	inp = input().strip().split()
	N = int(inp[0])
	K = int(inp[1])
	kids = input().strip().split()
	ontime_kids = 0
	for i in range(len(kids)):
		if int(kids[i]) < 1:
			ontime_kids += 1
			if ontime_kids == K:
				break
	if ontime_kids >= K:
		print('NO')
	else:
		print('YES')


import sys
T = int(input())
count = 0
for _ in range(T):
	(N, K) = list(map(int, sys.stdin.readline().split()))
	A = list(map(int, sys.stdin.readline().split()))
	for x in A:
		if x <= 0:
			count += 1
	if count >= K:
		print('NO')
	else:
		print('YES')
	count = 0


T = int(input())
for _ in range(T):
	(N, K) = input().split()
	N = int(N)
	K = int(K)
	students = 0
	arrivals = input().split()
	for i in arrivals:
		if int(i) <= 0:
			students += 1
	if students < K:
		print('YES')
	else:
		print('NO')


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


n = int(input())
for i in range(n):
	l = 0
	c = input().split(' ')
	K = int(c[1])
	a = input().split(' ')
	a = [int(i) for i in a]
	a.sort()
	for i in range(len(a)):
		if a[i] <= 0:
			l = i + 1
	if l >= K:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(N, K) = [int(i) for i in input().split()]
	students = [int(i) for i in input().split()]
	res = 0
	for stu in students:
		if stu <= 0:
			res += 1
	if res >= K:
		print('NO')
	else:
		print('YES')


def mainCalculation(time, size, atLeast):
	time = list(map(int, time))
	time.sort()
	for i in time:
		if i > 0:
			count = time.index(i)
			if count < atLeast:
				return 'YES'
			else:
				return 'NO'
caseSize = int(input())
for i in range(0, caseSize):
	factors = input().split(' ')
	size = int(factors[0])
	atLeast = int(factors[1])
	stuTime = input().split(' ')
	print(mainCalculation(stuTime, size, atLeast))


__author__ = 'ysyh'
stringWithAnswers = []
nrOfTestCase = int(input())
while nrOfTestCase > 0:
	count = 0
	line = input()
	myList = line.split(' ')
	n = int(myList[0])
	k = int(myList[1])
	time = input()
	timeTable = time.split(' ')
	for i in range(0, n):
		if int(timeTable[i]) <= 0:
			count += 1
	if count >= k:
		stringWithAnswers.append('NO')
	else:
		stringWithAnswers.append('YES')
	nrOfTestCase -= 1
for i in stringWithAnswers:
	print(i)


t = int(input(''))
l = []
for i in range(0, t):
	c = 0
	line = input()
	x = line.split(' ')
	n = int(x[0])
	k = int(x[1])
	line = input()
	x = line.split(' ')
	for i in range(0, n):
		a = int(x[i])
		if a <= 0:
			c += 1
	if c >= k:
		l.append('NO')
	else:
		l.append('YES')
le = len(l)
for i in range(0, le):
	print(l[i])


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


num_cases = int(input())
for q in range(num_cases):
	(w, e) = input().split()
	(n, k) = (int(w), int(e))
	s = input().split()
	arr_ls = []
	for x in s:
		arr_ls.append(int(x))
	j = 0
	for i in arr_ls:
		if i <= 0:
			j += 1
	if j >= k:
		print('NO')
	else:
		print('YES')


def solve():
	l = input().split()
	n = int(l[0])
	k = int(l[1])
	times = input().split()
	ontime = 0
	for i in range(n):
		if int(times[i]) <= 0:
			ontime = ontime + 1
		else:
			ontime = ontime
	if ontime < k:
		print('YES')
	else:
		print('NO')
lines = int(input())
for i in range(lines):
	solve()


def solve(times, k):
	count = 0
	for i in times:
		if i <= 0:
			count += 1
	if count < k:
		print('YES')
	else:
		print('NO')

def main():
	t = int(input())
	for i in range(t):
		line = input().split()
		n = int(line[0])
		k = int(line[1])
		line = input().split()
		times = [int(tok) for tok in line]
		solve(times, k)
main()


T = int(input())
for t in range(T):
	(N, K) = map(int, input().split(' '))
	St = map(int, input().split(' '))
	count = 0
	for i in St:
		if i <= 0:
			count += 1
		if count == K:
			print('NO')
			break
	if count != K:
		print('YES')


t = int(input())
while t > 0:
	l1 = str(input()).split()
	n = int(l1[0])
	k = int(l1[1])
	cnt = 0
	for i in input().strip().split():
		if int(i) <= 0:
			cnt = cnt + 1
	if cnt >= k:
		print('NO')
	else:
		print('YES')
	t = t - 1


for _ in range(int(input())):
	(n, k) = map(int, input().strip().split())
	numbers = [int(x) for x in input().strip().split()]
	if sum([1 for x in numbers if x <= 0]) < k:
		print('YES')
	else:
		print('NO')


def main():
	(a, b) = [int(x) for x in input().split()]
	l = input().split(' ')
	lis = []
	for x in l:
		lis.append(int(x))
	c = 0
	for x in lis:
		if x <= 0:
			c += 1
	if c < b:
		print('YES')
	else:
		print('NO')
t = int(input())
for t in range(t):
	main()


nc = int(input())
for ca in range(nc):
	(n, k) = (int(t) for t in input().split())
	tl = [int(t) for t in input().split()]
	m = sum((1 if x <= 0 else 0 for x in tl))
	print('YES' if m < k else 'NO')


__author__ = 'SR'
T = int(input())
result = []
for loop in range(T):
	students = input().split(' ')
	N = int(students[0])
	K = int(students[1])
	arrivalTime = input().split(' ')
	total = 0
	for i in range(N):
		time = int(arrivalTime[i])
		if time <= 0:
			total = total + 1
	if total >= K:
		result.append('NO')
	else:
		result.append('YES')
for i in result:
	print(i)


T = int(input())
i = 0
while i < T:
	c = 0
	s = input()
	s = s.split()
	N = int(s[0])
	K = int(s[1])
	p = input()
	p = p.split()
	j = 0
	while j < N:
		if int(p[j]) <= 0:
			c += 1
		j += 1
	if c < K:
		print('YES')
	else:
		print('NO')
	i += 1


T = int(input())
for i in range(T):
	(N, K) = map(int, input().split())
	if len(list(filter(lambda x: x <= 0, [int(x) for x in input().split()]))) >= K:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	times = map(int, input().split())
	total = sum([1 for time in times if time <= 0])
	if total < k:
		print('YES')
	else:
		print('NO')


T = int(input())
assert 1 <= T <= 10
for i in range(T):
	(N, K) = input().split()
	(N, K) = (int(N), int(K))
	assert 1 <= N <= 1000
	assert 1 <= K <= N
	at = [int(x) for x in input().split()]
	count = 0
	for i in range(len(at)):
		if at[i] <= 0:
			count = count + 1
	if count >= K:
		print('NO')
	else:
		print('YES')


def getNumOfStudsBeforeStart(string, k):
	arr = string.split()
	res = 0
	for i in range(len(arr)):
		if int(arr[i]) <= 0:
			res += 1
	return res >= int(k) and 'NO' or 'YES'
n = int(input())
for i in range(n):
	(peps, k) = str(input()).split()
	string = input()
	print(getNumOfStudsBeforeStart(string, k))


numTests = int(input())
for test in range(numTests):
	(numStudents, numNeeded) = [int(n) for n in input().split(' ')]
	times = [int(n) for n in input().split(' ')]
	onTime = len([t for t in times if t <= 0])
	if onTime < numNeeded:
		print('YES')
	else:
		print('NO')


def is_cancelled(times, k):
	return sum((time <= 0 for time in times)) < k
t = int(input())
for _ in range(t):
	(_, k) = [int(el) for el in input().split()]
	times = [int(el) for el in input().split()]
	print('YES' if is_cancelled(times, k) else 'NO')


import math
t = int(input())
for i in range(t):
	count = 0
	(n, k) = map(int, input().split())
	s = input()
	arrival = map(int, s.split())
	for n in arrival:
		if n <= 0:
			count = count + 1
	if count >= k:
		print('NO')
	else:
		print('YES')


from functools import reduce
T = int(input())
while T > 0:
	T -= 1
	(N, K) = [int(x) for x in input().split(' ')]
	arrival = len([x for x in input().split(' ') if int(x) <= 0])
	if arrival >= K:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	(n, k) = [int(i) for i in input().split()]
	l = [int(i) for i in input().split()]
	count = 0
	for i in range(n):
		if l[i] <= 0:
			count += 1
	if count < k:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for i in range(t):
		l = input().split(' ')
		k = eval(l[1])
		list = input().split(' ')
		for i in range(len(list)):
			list[i] = eval(list[i])
		count = 0
		for i in list:
			if i <= 0:
				count += 1
		if count >= k:
			print('NO')
		else:
			print('YES')
main()


for i in range(int(input())):
	K = int(input().split(' ')[1])
	arrivaltimes = [int(x) for x in input().split(' ')]
	arrivaltimes.sort()
	count = 0
	for arrivaltime in arrivaltimes:
		if arrivaltime <= 0:
			count += 1
		else:
			break
	if count >= K:
		print('NO')
	else:
		print('YES')


for t in range(int(input())):
	[N, K] = list(map(int, input().split()))
	a = list(map(int, input().split()))
	count = 0
	good = False
	for e in a:
		if e <= 0:
			count += 1
			if count >= K:
				good = True
				break
	if good:
		print('NO')
	else:
		print('YES')


tests = int(input())
for _ in range(tests):
	(n, k) = [int(x) for x in input().split()]
	intervals = [int(x) for x in input().split()]
	num = 0
	for interval in intervals:
		if interval <= 0:
			num += 1
	if num < k:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(N, K) = (int(x) for x in input().split())
	result = 'NO' if sum((1 if int(x) <= 0 else 0 for x in input().split())) >= K else 'YES'
	print(result)


import sys
cases = int(sys.stdin.readline().strip())
for case in range(0, cases):
	(n, k) = [int(x) for x in sys.stdin.readline().strip().split(' ')]
	present = 0
	students = (int(x) for x in sys.stdin.readline().strip().split(' '))
	for student in students:
		if student <= 0:
			present += 1
	if present < k:
		print('YES')
	else:
		print('NO')


def late(t):
	if int(t) <= 0:
		return 1
	else:
		return 0
T = int(input())
for _ in range(T):
	(N, K) = [int(i) for i in input().split()]
	t = [late(i) for i in input().split()]
	if sum(t) >= K:
		print('NO')
	else:
		print('YES')


def AngryProf(x, y):
	early = 0
	for i in y:
		if i <= 0:
			early = early + 1
	if early >= x[1]:
		return 'NO'
	else:
		return 'YES'
a = int(input())
for i in range(a):
	b = input()
	b = b.strip().split(' ')
	b = [int(i) for i in b]
	c = input()
	c = c.strip().split(' ')
	c = [int(i) for i in c]
	print(AngryProf(b, c))


def is_cancelled(n, k, a):
	return sum((1 for x in a if x <= 0)) < k
t = int(input())
read = lambda : (int(x) for x in input().split())
for _ in range(t):
	((n, k), a) = (read(), read())
	print('YES' if is_cancelled(n, k, a) else 'NO')


anz = int(input())
for i in range(anz):
	(n, k) = [int(x) for x in input().split()]
	students = sorted([int(x) for x in input().split()])
	if students[k - 1] <= 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	if len(list(filter(lambda x: x <= 0, l))) >= k:
		print('NO')
	else:
		print('YES')


ncase = int(input())

def n_ontime(arrivals):
	return len([x for x in arrivals if x <= 0])

def r():
	(n, k) = map(int, input().split(' '))
	arrivals = [int(x) for x in input().split(' ')]
	if n_ontime(arrivals) >= k:
		print('NO')
	else:
		print('YES')
for i in range(ncase):
	r()


__author__ = 'leo'
tests = int(input())
for i in range(tests):
	students_and_min_required = input().split()
	students = students_and_min_required[0]
	min_required = int(students_and_min_required[1])
	time_came = input().split()
	time_came = [int(i) for i in time_came]
	amount = 0
	for i in time_came:
		if i < 1:
			amount += 1
	if amount >= min_required:
		print('NO')
	else:
		print('YES')


def fun(L, k):
	cnt = 0
	for x in L:
		if x <= 0:
			cnt += 1
	if cnt >= k:
		return 'NO'
	else:
		return 'YES'
t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	L = list(map(int, input().split()))
	print(fun(L, k))


t = int(input())
for _ in range(t):
	(N, K) = (int(x) for x in input().split())
	StudentsPresent = 0
	ArrivalTime = [int(x) for x in input().split()]
	for Time in ArrivalTime:
		if Time <= 0:
			StudentsPresent += 1
			if StudentsPresent >= K:
				print('NO')
				break
	else:
		print('YES')


import sys
test = int(sys.stdin.readline())
for i in range(test):
	count = 0
	nl = []
	nj = []
	nj = list(map(int, input().split()))
	nl = list(map(int, input().split()))
	for _ in range(nj[0]):
		if int(nl[_]) <= 0:
			count = count + 1
	if count >= nj[1]:
		print('NO')
	else:
		print('YES')


z = int(input())
for i in range(z):
	lineone = str(input()).split(' ')
	linetwo = str(input()).split(' ')
	n = int(lineone[0])
	k = int(lineone[1])
	ontime = 0
	for j in range(n):
		time = int(linetwo[j])
		if time < 1:
			ontime += 1
	result = ontime < k
	print('YES' if result else 'NO')


def cancelClass(students, K):
	studentsOnTime = 0
	for student in students:
		if student <= 0:
			studentsOnTime += 1
	if studentsOnTime < K:
		return True
	else:
		return False
numTestCases = int(input())
for i in range(numTestCases):
	line1 = list(map(int, input().split(' ')))
	N = line1[0]
	K = line1[1]
	students = list(map(int, input().split(' ')))
	if cancelClass(students, K):
		print('YES')
	else:
		print('NO')


for testcases in range(int(input())):
	(students, value) = [int(x) for x in input().split()]
	arrivals = [int(x) for x in input().split(' ')]
	timley = 0
	for arrival in arrivals:
		if arrival <= 0:
			timley += 1
	if timley < value:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	(N, K) = (int(_) for _ in input().split())
	c = sum((1 if int(_) <= 0 else 0 for _ in input().split()))
	if c >= K:
		print('NO')
	else:
		print('YES')


__author__ = 'nolanemirot'

def classGetCanceled(N, K, arr):
	nbOnTime = 0
	for i in arr:
		if i <= 0:
			nbOnTime += 1
	if nbOnTime >= K:
		return 'NO'
	return 'YES'
nbTestCase = int(input())
for i in range(nbTestCase):
	line = input()
	arr = list(map(int, line.split()))
	N = arr[0]
	K = arr[1]
	studentLine = input()
	students = list(map(int, studentLine.split()))
	print(classGetCanceled(N, K, students))


__author__ = 'Bohdan'
N = int(input())
for tests in range(N):
	s = str(input())
	ss = s.split(' ')
	size = int(ss[0])
	k = int(ss[1])
	count = 0
	times = []
	arr_s = input().split(' ')
	for i in range(size):
		times.append(int(arr_s[i]))
	for i in range(size):
		if times[i] <= 0:
			count += 1
	if count < k:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	(students, needed_students) = (int(i) for i in input().split(' '))
	arrive_times = [int(i) for i in input().split(' ')]
	arrived_in_time_students = 0
	for time in arrive_times:
		if time < 1:
			arrived_in_time_students += 1
	if arrived_in_time_students >= needed_students:
		print('NO')
	else:
		print('YES')


test = int(input())
for j in range(0, test):
	count = 0
	(x, y) = input().split()
	list = [int(i) for i in input().strip().split()]
	for i in list:
		if i <= 0:
			count = count + 1
		else:
			i = i + 1
	if count < int(y):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().split())
	time = map(int, input().split())
	print('NO' if sum([x <= 0 for x in time]) >= b else 'YES')


for _ in range(int(input().strip())):
	(n, k) = map(int, input().strip().split())
	at_time = 0
	for s in map(int, input().strip().split()):
		if 0 >= s:
			at_time += 1
	print('NO' if at_time >= k else 'YES')


def isCanceled(ar, k):
	count = 0
	for x in ar:
		if x <= 0:
			count += 1
	if count < k:
		return 'YES'
	else:
		return 'NO'

def main():
	T = int(input())
	for x in range(T):
		(n, k) = map(int, input().split())
		tab = map(int, input().split())
		print(isCanceled(tab, k))
main()


T = int(input())
for i in range(0, T):
	(N, K) = [int(x) for x in input().split()]
	students = sorted([int(x) for x in input().split()])
	count = 0
	for student in students:
		if student <= 0:
			count += 1
		elif student >= 0:
			break
	if count < K:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	print('YES' if len(list(filter(lambda x: int(x) <= 0, input().split()))) < k else 'NO')


def isCancelled(N, K, array):
	ontimeStudentNum = 0
	iterator = 0
	for i in range(0, len(array)):
		if array[i] <= 0:
			ontimeStudentNum += 1
		if ontimeStudentNum >= K:
			return 'NO'
	return 'YES'
inputlength = int(input().strip())
for i in range(inputlength):
	firstArray = [int(i) for i in input().strip().split()]
	totalStudentNum = firstArray[0]
	desiredAttendance = firstArray[1]
	studentArrivalTime = [int(i) for i in input().strip().split()]
	print(isCancelled(totalStudentNum, desiredAttendance, studentArrivalTime))


testcases = int(input())
for test in range(testcases):
	NK = input()
	NK = [int(i) for i in NK.split()]
	students = input()
	students = [int(i) for i in students.split()]
	on_time = 0
	for student in students:
		if student <= 0:
			on_time += 1
	if on_time >= NK[1]:
		print('NO')
	else:
		print('YES')


for x in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	count = 0
	for i in a:
		if i <= 0:
			count += 1
	if count < m:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(0, T):
	(N, K) = [int(i) for i in input().split(' ')]
	c = 0
	for i in input().split(' '):
		if int(i) <= 0:
			c += 1
	print('YES' if c < K else 'NO')


t = int(input())
for i in range(t):
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	current_k = 0
	arrivals = input().split()
	for arrival in arrivals:
		if int(arrival) <= 0:
			current_k += 1
	if current_k < k:
		print('YES')
	else:
		print('NO')


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


a = int(input())
b = 0
while b < a:
	(c, d) = input().split(' ')
	(c, d) = (int(c), int(d))
	ls = input().split(' ')
	for e in range(0, c):
		ls[e] = int(ls[e])
	ls.sort()
	(f, res) = (0, 'YES')
	while f < c:
		if ls[f] < 1 and f + 1 >= d:
			res = 'NO'
		f += 1
	print(res)
	b += 1


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


n = int(input())
for i in range(0, n):
	(n, k) = input().split(' ')
	arrival = input().split(' ')
	missed = 0
	for time in arrival:
		if int(time) > 0:
			missed = missed + 1
	if int(n) - missed < int(k):
		print('YES')
	else:
		print('NO')


cases = int(input())
answers = []
for i in range(0, cases):
	(students, minStu) = [int(i) for i in input().split(' ')]
	arrivalTimes = [int(i) for i in input().split(' ')]
	arrivalTimes.sort()
	if arrivalTimes[minStu - 1] > 0:
		answers.append('YES')
	else:
		answers.append('NO')
for i in answers:
	print(i)


for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	ts = [int(i) for i in input().split()]
	print('YES' if len(list(filter(lambda t: t <= 0, ts))) < k else 'NO')


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


for case in range(int(input())):
	(N, K) = (int(i) for i in input().split())
	attendance = 0
	for i in input().split():
		if int(i) <= 0:
			attendance = attendance + 1
	if attendance < K:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	s = input().split()
	a = input().split()
	arrival = [int(x) for x in a if int(x) <= 0]
	N = int(s[1])
	if N > len(arrival):
		print('YES')
	else:
		print('NO')


from functools import reduce
no_of_tests = int(input())
for i in range(no_of_tests):
	(total_num, min_num) = [int(x) for x in input().split()]
	students = [int(x) for x in input().split()]
	on_time_students = len([x for x in students if x <= 0])
	if on_time_students >= min_num:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	nk = input().split()
	n = int(nk[0])
	k = int(nk[1])
	tm = input().split()
	sum = 0
	for item in tm:
		if int(item) <= 0:
			sum = sum + 1
	if sum >= k:
		print('NO')
	else:
		print('YES')


for session in range(0, int(input())):
	studentsOnTime = 0
	neededStudentsOnTime = int(input().split()[1])
	arrivalTimes = [int(i) for i in input().split()]
	for arrivalTime in arrivalTimes:
		if arrivalTime <= 0:
			studentsOnTime += 1
	if studentsOnTime < neededStudentsOnTime:
		print('YES')
	else:
		print('NO')


class ArrivalTimes:

	def __init__(self, students, cutoff):
		self.students = int(students)
		self.cutoff = int(cutoff)

	def arrival_times(self, arrivals):
		arrival_list = arrivals.split(' ')
		self.arrival_list = [int(arrival) for arrival in arrival_list]

	def cancel_class(self):
		on_time = [item for item in self.arrival_list if item <= 0]
		if len(on_time) < self.cutoff:
			return 'YES'
		else:
			return 'NO'
cases = input()
for case in range(0, int(cases)):
	criteria = input()
	(students, cutoff) = criteria.split(' ')
	c_class = ArrivalTimes(students, cutoff)
	times = input()
	c_class.arrival_times(times)
	class_cancelled = c_class.cancel_class()
	print(class_cancelled)


t = int(input())
for _ in range(0, t):
	(n, k) = [int(x) for x in input().split(' ')]
	students = [int(x) for x in input().split(' ')]
	if sum(map(lambda x: x <= 0, students)) >= k:
		print('NO')
	else:
		print('YES')


t = int(input())
assert 1 <= t <= 10
for i in range(t):
	(n, k) = [int(x) for x in str(input()).split()]
	assert 1 <= n <= 1000 and 1 <= k <= n
	time = [int(x) for x in str(input()).split()]
	time.sort()
	if time[k - 1] > 0:
		print('YES')
	else:
		print('NO')


def check(n, m, l):
	m = int(m)
	n = int(n)
	l = list(map(int, l))
	l1 = [x for x in l if x < 0 or x == 0]
	if len(l1) < m:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(t):
	(n, m) = input().split(' ')
	l = input().split(' ')
	check(n, m, l)


def cancelled(time, cutoff):
	count = 0
	for timing in time:
		if timing <= 0:
			count += 1
	if count < cutoff:
		return 'YES'
	else:
		return 'NO'
test = int(input())
for i in range(test):
	[students, cutoff] = [int(i) for i in input().split()]
	time = [int(i) for i in input().split()]
	print(cancelled(time, cutoff))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = map(int, input().split())
	nintime = sum((1 for ai in a if ai <= 0))
	print('NO' if nintime >= k else 'YES')


T = int(input())
for _ in range(T):
	(N, K) = [int(c) for c in input().strip().split()]
	A = [int(c) for c in input().strip().split()]
	assert len(A) == N
	count = 0
	for s in A:
		if s <= 0:
			count += 1
	if count < K:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(N, K) = [int(i) for i in input().split()]
	students = [int(i) for i in input().split()]
	res = 0
	for stu in students:
		if stu <= 0:
			res += 1
	if res >= K:
		print('NO')
	else:
		print('YES')


for T in range(int(input())):
	(n, k) = input().split()
	l = list((int(i) for i in input().split() if int(i) <= 0))
	print('NO') if len(l) >= int(k) else print('YES')


testCaseCount = int(input())
solutions = []
for i in range(testCaseCount):
	tc = {}
	(tc['total'], tc['required']) = [int(i) for i in input().split(' ')]
	tc['arrivalTimes'] = [int(i) for i in input().split(' ')]
	if sum([1 for i in tc['arrivalTimes'] if i <= 0]) >= tc['required']:
		solutions.append('NO')
	else:
		solutions.append('YES')
[print(str(solution)) for solution in solutions]


t = int(input())
results = []
for i in range(t):
	(n, k) = map(int, input().split())
	s = list(map(int, input().split()))
	res = len(list(filter(lambda x: x <= 0, s)))
	if res >= k:
		results.append('NO')
	else:
		results.append('YES')
for i in results:
	print(i)


def angry():
	counter = 0
	inList1 = tuple(map(int, input().split()))
	inList2 = tuple(map(int, input().split()))
	for x in range(0, len(inList2)):
		if inList2[x] <= 0:
			counter += 1
	if counter < inList1[1]:
		print('YES')
	else:
		print('NO')
numberOfTests = int(input())
for x in range(0, numberOfTests):
	angry()


T = int(input())
for t in range(0, T):
	line = [int(z) for z in input().split()]
	N = line[0]
	K = line[1]
	attendance = [int(z) for z in input().split()]
	for a in attendance:
		if a <= 0:
			K -= 1
	print('YES' if K > 0 else 'NO')


def class_cancelled(times, k):
	for t in times:
		if t <= 0:
			k -= 1
	if k > 0:
		return 'YES'
	else:
		return 'NO'
for i in range(0, int(input())):
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	times = []
	for num in input().split():
		num = int(num)
		times.append(num)
	print(class_cancelled(times, k))


t = int(input())
for i in range(t):
	(N, K) = input().split()
	(N, K) = (int(N), int(K))
	l = input().split()
	l = [int(x) for x in l]
	count = 0
	for x in l:
		if x <= 0:
			count = count + 1
	if count < K:
		print('YES')
	else:
		print('NO')