#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 */
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
scalar_t__ solve(int *, int, int /*<<< orphan*/, int /*<<< orphan*/, int);
int main() {
  int cases;
  scanf("%d", &cases);
  int i;
  for (i = 0; i < cases; i++) {
    int n, m;
    scanf("%d %d", &n, &m);
    int *arr = (int *)malloc(sizeof(int) * n);
    int j;
    for (j = 0; j < n; j++) {
      scanf("%d", &arr[j]);
    }
    printf("%s\n", solve(arr, n, 0, 0, m) ? "Yes" : "No");
    free(arr);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9d(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    123b <main+0xeb>
lea    0xe75(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1070 <scanf@plt>
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11eb <main+0x9b>
mov    -0x20(%rbp),%rsi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11b4 <main+0x64>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%r8d
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <solve@plt>
mov    %rax,%rcx
lea    0xe05(%rip),%rsi
lea    0xdfa(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xde7(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1178 <main+0x28>
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    0xe9e(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
jle    1234 <main+0xe4>
lea    0xe80(%rip),%rbx
lea    0xe7c(%rip),%r13
xor    %r15d,%r15d
jmp    11d1 <main+0x81>
nop
mov    0x14(%rsp),%r8d
mov    %r14,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <solve@plt>
test   %rax,%rax
lea    0xe5f(%rip),%rsi
lea    0xe5c(%rip),%rax
cmove  %rax,%rsi
mov    %r13,%rdi
call   1050 <printf@plt>
mov    %r14,%rdi
call   1040 <free@plt>
add    $0x1,%r15d
cmp    0x10(%rsp),%r15d
jge    1234 <main+0xe4>
lea    0xe28(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x14(%rsp),%rdx
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0xc(%rsp),%edi
shl    $0x2,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    1190 <main+0x40>
mov    %r14,%rbp
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
add    $0x1,%r12
movslq 0xc(%rsp),%rsi
add    $0x4,%rbp
cmp    %rsi,%r12
jl     1210 <main+0xc0>
jmp    1190 <main+0x40>
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 = [6 x i8] c"%d %d\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [4 x i8] c"Yes\00"
@.str.4 = [3 x i8] c"No\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
store i32 0, i32* %1
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %9
9: ; preds = %45, %0
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %48
13: ; preds = %9
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5)
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = mul i64 4, %16
%18 = trunc i64 %17 to i32
%19 = call i64 @malloc(i32 %18)
%20 = inttoptr i64 %19 to i32*
store i32* %20, i32** %6
store i32 0, i32* %7
br label %21
21: ; preds = %31, %13
%22 = load i32, i32* %7
%23 = load i32, i32* %4
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %34
25: ; preds = %21
%26 = load i32*, i32** %6
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %26, i64 %28
%30 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %29)
br label %31
31: ; preds = %25
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %7
br label %21
34: ; preds = %21
%35 = load i32*, i32** %6
%36 = load i32, i32* %4
%37 = load i32, i32* %5
%38 = call i64 @solve(i32* %35, i32 %36, i32 0, i32 0, i32 %37)
%39 = icmp ne i64 %38, 0
%40 = zext i1 %39 to i64
%41 = select i1 %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0)
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %41)
%43 = load i32*, i32** %6
%44 = call i32 @free(i32* %43)
br label %45
45: ; preds = %34
%46 = load i32, i32* %3
%47 = add nsw i32 %46, 1
store i32 %47, i32* %3
br label %9
48: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [4 x i8] c"Yes\00"
@.str.4 = [3 x i8] c"No\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %39
8: ; preds = %0
%9 = bitcast i32* %2 to i8*
%10 = bitcast i32* %3 to i8*
br label %11
11: ; preds = %8, %28
%12 = phi i32 [ 0, %8 ], [ %36, %28 ]
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%14 = load i32, i32* %2
%15 = shl i32 %14, 2
%16 = call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to i32*
%18 = load i32, i32* %2
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %28
20: ; preds = %11, %20
%21 = phi i64 [ %24, %20 ], [ 0, %11 ]
%22 = getelementptr inbounds i32, i32* %17, i64 %21
%23 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %22)
%24 = add nuw nsw i64 %21, 1
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = icmp slt i64 %24, %26
br i1 %27, label %20, label %28
28: ; preds = %20, %11
%29 = phi i32 [ %18, %11 ], [ %25, %20 ]
%30 = load i32, i32* %3
%31 = call i64 @solve(i32* %17, i32 %29, i32 0, i32 0, i32 %30)
%32 = icmp eq i64 %31, 0
%33 = select i1 %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %33)
%35 = call i32 @free(i32* %17)
%36 = add nuw nsw i32 %12, 1
%37 = load i32, i32* %1
%38 = icmp slt i32 %36, %37
br i1 %38, label %11, label %39
39: ; preds = %28, %0
ret i32 0
}