#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 *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  unsigned int n, k, b, sum = 0;
  scanf("%d %d", &n, &k);
  int *a = malloc(sizeof(int) * n);
  for (int i; i < n; i++) {
    scanf("%d", &a[i]);
    if (i == k) {
      continue;
    }
    sum += a[i];
  }
  scanf("%d", &b);
  if (b == (sum / 2)) {
    printf("Bon Appetit");
  } else {
    printf("%d", b - (sum / 2));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    11c7 <main+0x97>
mov    -0x20(%rbp),%rsi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11a8 <main+0x78>
jmp    11b9 <main+0x89>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116e <main+0x3e>
lea    0xe35(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    -0x14(%rbp),%ecx
shr    $0x1,%ecx
cmp    %ecx,%eax
jne    11fd <main+0xcd>
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1216 <main+0xe6>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%eax
shr    $0x1,%eax
sub    %eax,%esi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x14(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x10(%rsp),%edi
shl    $0x2,%edi
call   1040 <malloc@plt>
lea    0xea4(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
je     1183 <main+0x53>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1191 <main+0x61>
lea    0xe7c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"Bon Appetit\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
store i32 0, i32* %5
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = mul i64 4, %10
%12 = trunc i64 %11 to i32
%13 = call i32* @malloc(i32 %12)
store i32* %13, i32** %6
br label %14
14: ; preds = %36, %0
%15 = load i32, i32* %7
%16 = load i32, i32* %2
%17 = icmp ult i32 %15, %16
br i1 %17, label %18, label %39
18: ; preds = %14
%19 = load i32*, i32** %6
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = load i32, i32* %7
%25 = load i32, i32* %3
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %28
27: ; preds = %18
br label %36
28: ; preds = %18
%29 = load i32*, i32** %6
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
%33 = load i32, i32* %32
%34 = load i32, i32* %5
%35 = add i32 %34, %33
store i32 %35, i32* %5
br label %36
36: ; preds = %28, %27
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %14
39: ; preds = %14
%40 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%41 = load i32, i32* %4
%42 = load i32, i32* %5
%43 = udiv i32 %42, 2
%44 = icmp eq i32 %41, %43
br i1 %44, label %45, label %47
45: ; preds = %39
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %53
47: ; preds = %39
%48 = load i32, i32* %4
%49 = load i32, i32* %5
%50 = udiv i32 %49, 2
%51 = sub i32 %48, %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %47, %45
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"Bon Appetit\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%8 = load i32, i32* %1
%9 = shl i32 %8, 2
%10 = call i32* @malloc(i32 %9)
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %18
18: ; preds = %16, %14
ret i32 0
}