#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*/ bubblesort(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int a, d, i, j;
  while (1) {
    int c = 0;
    scanf("%d%d", &a, &d);
    if (a == 0 && d == 0)
      break;
    int at[a], def[d];
    for (i = 0; i < a; i++)
      scanf("%d", &at[i]);
    for (i = 0; i < d; i++)
      scanf("%d", &def[i]);
    bubblesort(def, d);
    for (i = 0; i < a; i++) {
      if (at[i] < def[1]) {
        c = 1;
        break;
      }
    }
    if (c == 0)
      printf("N\n");
    else
      printf("Y\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1175 <main+0x45>
cmpl   $0x0,-0xc(%rbp)
jne    1175 <main+0x45>
jmp    12c1 <main+0x191>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11fa <main+0xca>
mov    -0x40(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c3 <main+0x93>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1238 <main+0x108>
mov    -0x38(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1201 <main+0xd1>
mov    -0x38(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <bubblesort@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    128e <main+0x15e>
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%rax
movslq -0x10(%rbp),%rdx
mov    (%rax,%rdx,4),%eax
cmp    0x4(%rcx),%eax
jge    127b <main+0x14b>
movl   $0x1,-0x18(%rbp)
jmp    128e <main+0x15e>
jmp    1280 <main+0x150>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    124b <main+0x11b>
cmpl   $0x0,-0x18(%rbp)
jne    12a9 <main+0x179>
lea    0xd66(%rip),%rdi
call   1030 <printf@plt>
jmp    12b5 <main+0x185>
lea    0xd58(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
jmp    113f <main+0xf>
xor    %eax,%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    0xeb8(%rip),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    -0x30(%rbp),%eax
mov    -0x2c(%rbp),%ecx
or     %eax,%ecx
jne    1172 <main+0x42>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe89(%rip),%r15
jmp    11b0 <main+0x80>
nopl   0x0(%rax,%rax,1)
lea    0xe7e(%rip),%rdi
call   1030 <puts@plt>
mov    -0x38(%rbp),%rsp
lea    0xe69(%rip),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    -0x30(%rbp),%eax
mov    -0x2c(%rbp),%ecx
or     %eax,%ecx
je     1161 <main+0x31>
mov    %rsp,%rcx
mov    %eax,%eax
mov    %rsp,%r12
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    -0x2c(%rbp),%esi
mov    %rsp,%r13
lea    0xf(,%rsi,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
cmpl   $0x0,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
jle    1221 <main+0xf1>
mov    %r12,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq -0x30(%rbp),%rax
add    $0x4,%r14
cmp    %rax,%rbx
jl     1200 <main+0xd0>
mov    -0x2c(%rbp),%esi
test   %esi,%esi
jle    124e <main+0x11e>
mov    %r13,%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rsi
add    $0x4,%r14
cmp    %rsi,%rbx
jl     1230 <main+0x100>
mov    %r13,%rdi
call   1050 <bubblesort@plt>
mov    -0x30(%rbp),%eax
lea    0xda7(%rip),%rdi
test   %eax,%eax
jle    1187 <main+0x57>
mov    0x4(%r13),%ecx
xor    %edx,%edx
xchg   %ax,%ax
cmp    %ecx,(%r12,%rdx,4)
jl     1180 <main+0x50>
add    $0x1,%rdx
cmp    %rdx,%rax
jne    1270 <main+0x140>
lea    0xd7d(%rip),%rdi
jmp    1187 <main+0x57>

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

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