#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int t, n, i, j, k, turn, timeStudent, studentsOnTime;
  bool isCancelled = false;
  int *result = NULL;
  scanf("%d", &t);
  result = (int *)malloc(t * sizeof(int));
  for (j = 0; j < t; j++) {
    studentsOnTime = 0;
    scanf("%d%d", &n, &k);
    for (i = 0; i < n; i++) {
      scanf("%d", &timeStudent);
      if (timeStudent <= 0) {
        studentsOnTime++;
      }
    }
    isCancelled = !(studentsOnTime >= k);
    if (isCancelled) {
      result[j] = 1;
    } else {
      result[j] = 0;
    }
  }
  for (i = 0; i < t; i++) {
    if (result[i] == 1) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
lea    0xead(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1241 <main+0x111>
movl   $0x0,-0x24(%rbp)
lea    0xe6c(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ee <main+0xbe>
lea    0xe45(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x0,-0x20(%rbp)
jg     11db <main+0xab>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11e0 <main+0xb0>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11aa <main+0x7a>
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
setge  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     121f <main+0xef>
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    122e <main+0xfe>
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    1233 <main+0x103>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117a <main+0x4a>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1296 <main+0x166>
mov    -0x30(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    1277 <main+0x147>
lea    0xd98(%rip),%rdi
call   1030 <printf@plt>
jmp    1283 <main+0x153>
lea    0xd8c(%rip),%rdi
call   1030 <printf@plt>
jmp    1288 <main+0x158>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1248 <main+0x118>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebd(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%edi
shl    $0x2,%edi
call   1040 <malloc@plt>
cmpl   $0x0,0x8(%rsp)
jle    1233 <main+0x103>
mov    %rax,%r13
lea    0xe90(%rip),%rbx
lea    0x10(%rsp),%rbp
xor    %r14d,%r14d
jmp    119d <main+0x6d>
nopl   0x0(%rax)
xor    %eax,%eax
cmp    0x14(%rsp),%r15d
setl   %al
mov    %eax,0x0(%r13,%r14,4)
add    $0x1,%r14
movslq 0x8(%rsp),%rax
cmp    %rax,%r14
jge    11f7 <main+0xc7>
lea    0xe5c(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x14(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
mov    $0x0,%r15d
jle    1180 <main+0x50>
xor    %r15d,%r15d
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
xor    %eax,%eax
cmpl   $0x0,0x10(%rsp)
setle  %al
add    %eax,%r15d
add    $0x1,%r12d
cmp    0xc(%rsp),%r12d
jl     11d0 <main+0xa0>
jmp    1180 <main+0x50>
test   %eax,%eax
jle    1233 <main+0x103>
xor    %ebx,%ebx
lea    0xe04(%rip),%rbp
lea    0xdfa(%rip),%r14
jmp    1223 <main+0xf3>
nopl   (%rax)
call   1030 <puts@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jge    1233 <main+0x103>
cmpl   $0x1,0x0(%r13,%rbx,4)
mov    %rbp,%rdi
je     1210 <main+0xe0>
mov    %r14,%rdi
jmp    1210 <main+0xe0>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [5 x i8] c"YES\0A\00"
@.str.3 = [4 x i8] c"NO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
store i32 0, i32* %1
store i32 0, i32* %10
store i32* null, i32** %11
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 4
%16 = trunc i64 %15 to i32
%17 = call i64 @malloc(i32 %16)
%18 = inttoptr i64 %17 to i32*
store i32* %18, i32** %11
store i32 0, i32* %5
br label %19
19: ; preds = %59, %0
%20 = load i32, i32* %5
%21 = load i32, i32* %2
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %62
23: ; preds = %19
store i32 0, i32* %9
%24 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %6)
store i32 0, i32* %4
br label %25
25: ; preds = %37, %23
%26 = load i32, i32* %4
%27 = load i32, i32* %3
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %40
29: ; preds = %25
%30 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
%31 = load i32, i32* %8
%32 = icmp sle i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %36
36: ; preds = %33, %29
br label %37
37: ; preds = %36
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %25
40: ; preds = %25
%41 = load i32, i32* %9
%42 = load i32, i32* %6
%43 = icmp sge i32 %41, %42
%44 = xor i1 %43, true
%45 = zext i1 %44 to i32
store i32 %45, i32* %10
%46 = load i32, i32* %10
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %53
48: ; preds = %40
%49 = load i32*, i32** %11
%50 = load i32, i32* %5
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %49, i64 %51
store i32 1, i32* %52
br label %58
53: ; preds = %40
%54 = load i32*, i32** %11
%55 = load i32, i32* %5
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i32, i32* %54, i64 %56
store i32 0, i32* %57
br label %58
58: ; preds = %53, %48
br label %59
59: ; preds = %58
%60 = load i32, i32* %5
%61 = add nsw i32 %60, 1
store i32 %61, i32* %5
br label %19
62: ; preds = %19
store i32 0, i32* %4
br label %63
63: ; preds = %79, %62
%64 = load i32, i32* %4
%65 = load i32, i32* %2
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %82
67: ; preds = %63
%68 = load i32*, i32** %11
%69 = load i32, i32* %4
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i32, i32* %68, i64 %70
%72 = load i32, i32* %71
%73 = icmp eq i32 %72, 1
br i1 %73, label %74, label %76
74: ; preds = %67
%75 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %78
76: ; preds = %67
%77 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %78
78: ; preds = %76, %74
br label %79
79: ; preds = %78
%80 = load i32, i32* %4
%81 = add nsw i32 %80, 1
store i32 %81, i32* %4
br label %63
82: ; preds = %63
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
@str = [3 x i8] c"NO\00"
@str.4 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = shl i32 %10, 2
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i32*
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, 0
br i1 %15, label %18, label %55
16: ; preds = %34
%17 = icmp sgt i32 %41, 0
br i1 %17, label %44, label %55
18: ; preds = %0, %34
%19 = phi i64 [ %40, %34 ], [ 0, %0 ]
%20 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%21 = load i32, i32* %2
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %34
23: ; preds = %18, %23
%24 = phi i32 [ %30, %23 ], [ 0, %18 ]
%25 = phi i32 [ %31, %23 ], [ 0, %18 ]
%26 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%27 = load i32, i32* %4
%28 = icmp slt i32 %27, 1
%29 = zext i1 %28 to i32
%30 = add nuw nsw i32 %24, %29
%31 = add nuw nsw i32 %25, 1
%32 = load i32, i32* %2
%33 = icmp slt i32 %31, %32
br i1 %33, label %23, label %34
34: ; preds = %23, %18
%35 = phi i32 [ 0, %18 ], [ %30, %23 ]
%36 = load i32, i32* %3
%37 = icmp slt i32 %35, %36
%38 = zext i1 %37 to i32
%39 = getelementptr inbounds i32, i32* %13, i64 %19
store i32 %38, i32* %39
%40 = add nuw nsw i64 %19, 1
%41 = load i32, i32* %1
%42 = sext i32 %41 to i64
%43 = icmp slt i64 %40, %42
br i1 %43, label %18, label %16
44: ; preds = %16, %44
%45 = phi i64 [ %51, %44 ], [ 0, %16 ]
%46 = getelementptr inbounds i32, i32* %13, i64 %45
%47 = load i32, i32* %46
%48 = icmp eq i32 %47, 1
%49 = select i1 %48, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0)
%50 = call i32 @puts(i8* dereferenceable(1) %49)
%51 = add nuw nsw i64 %45, 1
%52 = load i32, i32* %1
%53 = sext i32 %52 to i64
%54 = icmp slt i64 %51, %53
br i1 %54, label %44, label %55
55: ; preds = %44, %0, %16
ret i32 0
}