#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
main() {
  long int i, j = 0, n, l = 0;
  int m;
  scanf("%d", &m);
  scanf("%ld", &n);
  long int a[m * m];
  for (i = 0; i < (m * m); i++)
    scanf("%d", &a[i]);
  for (i = 0; a[i] <= n; i++) {
    if (a[i] == n) {
      printf("YES");
      l = 1;
      break;
    }
    if (i == m * m)
      break;
  }
  if (l != 1)
    printf("NO");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
lea    0xeba(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x49(%rbp)
lea    -0x2c(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x49(%rbp),%al
lea    0xea5(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x2c(%rbp),%eax
imul   %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jge    11de <main+0xbe>
mov    -0x48(%rbp),%rsi
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1199 <main+0x79>
movq   $0x0,-0x10(%rbp)
mov    -0x48(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmp    -0x20(%rbp),%rax
jg     125d <main+0x13d>
mov    -0x48(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmp    -0x20(%rbp),%rax
jne    122b <main+0x10b>
lea    0xdee(%rip),%rdi
call   1030 <printf@plt>
movq   $0x1,-0x28(%rbp)
jmp    125d <main+0x13d>
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jne    1247 <main+0x127>
jmp    125d <main+0x13d>
jmp    124c <main+0x12c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11e6 <main+0xc6>
cmpq   $0x1,-0x28(%rbp)
je     1274 <main+0x154>
lea    0xd9c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xec8(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x38(%rbp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rsp,%r15
mov    -0x2c(%rbp),%eax
imul   %eax,%eax
mov    %rsp,%r12
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    -0x2c(%rbp),%eax
imul   %eax,%eax
test   %eax,%eax
je     11c6 <main+0xa6>
lea    0xe7c(%rip),%r14
mov    %r12,%r13
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x1,%rbx
mov    -0x2c(%rbp),%ecx
imul   %ecx,%ecx
add    $0x8,%r13
cmp    %rcx,%rbx
jb     1190 <main+0x70>
mov    (%r12),%rdx
mov    -0x38(%rbp),%rax
cmp    %rax,%rdx
jle    11ce <main+0xae>
lea    0xe47(%rip),%rdi
jmp    11fb <main+0xdb>
mov    -0x38(%rbp),%rax
xor    %ecx,%ecx
jmp    11d0 <main+0xb0>
mov    %ecx,%ecx
xor    %esi,%esi
lea    0xe2e(%rip),%rdi
lea    0xe2b(%rip),%rbx
cmp    %rax,%rdx
je     11fb <main+0xdb>
cmp    %rsi,%rcx
je     11f8 <main+0xd8>
mov    0x8(%r12,%rsi,8),%rdx
add    $0x1,%rsi
cmp    %rax,%rdx
jle    11e0 <main+0xc0>
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %r15,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%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 = [4 x i8] c"%ld\00"
@.str.2 = [4 x i8] c"YES\00"
@.str.3 = [3 x i8] c"NO\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %3
store i64 0, i64* %5
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %4)
%11 = load i32, i32* %6
%12 = load i32, i32* %6
%13 = mul nsw i32 %11, %12
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %7
%16 = alloca i64, i64 %14
store i64 %14, i64* %8
store i64 0, i64* %2
br label %17
17: ; preds = %28, %0
%18 = load i64, i64* %2
%19 = load i32, i32* %6
%20 = load i32, i32* %6
%21 = mul nsw i32 %19, %20
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %18, %22
br i1 %23, label %24, label %31
24: ; preds = %17
%25 = load i64, i64* %2
%26 = getelementptr inbounds i64, i64* %16, i64 %25
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64* %26)
br label %28
28: ; preds = %24
%29 = load i64, i64* %2
%30 = add nsw i64 %29, 1
store i64 %30, i64* %2
br label %17
31: ; preds = %17
store i64 0, i64* %2
br label %32
32: ; preds = %55, %31
%33 = load i64, i64* %2
%34 = getelementptr inbounds i64, i64* %16, i64 %33
%35 = load i64, i64* %34
%36 = load i64, i64* %4
%37 = icmp sle i64 %35, %36
br i1 %37, label %38, label %58
38: ; preds = %32
%39 = load i64, i64* %2
%40 = getelementptr inbounds i64, i64* %16, i64 %39
%41 = load i64, i64* %40
%42 = load i64, i64* %4
%43 = icmp eq i64 %41, %42
br i1 %43, label %44, label %46
44: ; preds = %38
%45 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i64 1, i64* %5
br label %58
46: ; preds = %38
%47 = load i64, i64* %2
%48 = load i32, i32* %6
%49 = load i32, i32* %6
%50 = mul nsw i32 %48, %49
%51 = sext i32 %50 to i64
%52 = icmp eq i64 %47, %51
br i1 %52, label %53, label %54
53: ; preds = %46
br label %58
54: ; preds = %46
br label %55
55: ; preds = %54
%56 = load i64, i64* %2
%57 = add nsw i64 %56, 1
store i64 %57, i64* %2
br label %32
58: ; preds = %53, %44, %32
%59 = load i64, i64* %5
%60 = icmp ne i64 %59, 1
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %63
63: ; preds = %61, %58
store i32 0, i32* %1
%64 = load i8*, i8** %7
%65 = load i32, i32* %1
ret i32 %65
}

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