program forbidden
  implicit none
  integer :: x, n, ans, d, i, j
  integer,allocatable :: p(:)
  logical :: status

  read(*,*) x, n
  if (n == 0) then
     read(*,*) 
     write(*,'(i0)') x
     stop
  end if
  allocate(p(n))
  read(*,*) p
  d = 1000
  do i = 0, 101
     status = .true.
     do j = 1, n
        if ( i == p(j) ) then
           status = .false.
           exit
        end if
     end do
     if (status) then
        if (abs(i-x)<d) then
           ans = i
           d = abs(i-x)
        end if
     end if
  end do
  
  write(*,'(i0)') ans
  stop
end program forbidden

; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEp.0 = internal unnamed_addr global ptr null
@_QFEp.8 = internal unnamed_addr global i64 0
@_QQcl.fc107ea821020307dcf6ff976d6c6cc0 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1198/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #1 {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.fc107ea821020307dcf6ff976d6c6cc0, i32 7)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 4)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 4)
  %7 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %8 = load i32, ptr %2, align 4, !tbaa !3
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %10, label %18

10:                                               ; preds = %0
  %11 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.fc107ea821020307dcf6ff976d6c6cc0, i32 9)
  %12 = call i32 @_FortranAioEndIoStatement(ptr %11)
  %13 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.fc107ea821020307dcf6ff976d6c6cc0, i32 10)
  %14 = load i32, ptr %3, align 4, !tbaa !3
  %15 = call i1 @_FortranAioOutputInteger32(ptr %13, i32 %14)
  %16 = call i32 @_FortranAioEndIoStatement(ptr %13)
  %17 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

18:                                               ; preds = %0
  %19 = call i32 @llvm.smax.i32(i32 %8, i32 0)
  %20 = zext i32 %19 to i64
  %21 = shl nuw nsw i64 %20, 2
  %22 = call ptr @malloc(i64 %21)
  store ptr %22, ptr @_QFEp.0, align 8, !tbaa !7
  store i64 %20, ptr @_QFEp.8, align 8, !tbaa !7
  %23 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.fc107ea821020307dcf6ff976d6c6cc0, i32 14)
  %.unpack = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %.unpack105.unpack.unpack107 = load i64, ptr @_QFEp.8, align 8, !tbaa !7
  store ptr %.unpack, ptr %1, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !7
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 %.unpack105.unpack.unpack107, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %24 = call i1 @_FortranAioInputDescriptor(ptr %23, ptr nonnull %1)
  %25 = call i32 @_FortranAioEndIoStatement(ptr %23)
  %26 = load i32, ptr %2, align 4, !tbaa !3
  %27 = icmp sgt i32 %26, 0
  %.unpack110 = load ptr, ptr @_QFEp.0, align 8
  %28 = load i32, ptr %3, align 4
  br i1 %27, label %.lr.ph.us, label %.critedge

.lr.ph.us:                                        ; preds = %18, %.loopexit.us
  %.082128.us = phi i32 [ %37, %.loopexit.us ], [ 0, %18 ]
  %.083127.us = phi i32 [ %.1.us, %.loopexit.us ], [ 1000, %18 ]
  %.084126.us = phi i32 [ %.185.us, %.loopexit.us ], [ undef, %18 ]
  br label %29

29:                                               ; preds = %.lr.ph.us, %35
  %.081124.us = phi i32 [ 1, %.lr.ph.us ], [ %36, %35 ]
  %30 = sext i32 %.081124.us to i64
  %31 = add nsw i64 %30, -1
  %32 = getelementptr i32, ptr %.unpack110, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !3
  %34 = icmp eq i32 %.082128.us, %33
  br i1 %34, label %.loopexit.us, label %35

35:                                               ; preds = %29
  %36 = add nuw i32 %.081124.us, 1
  %exitcond132.not = icmp eq i32 %.081124.us, %26
  br i1 %exitcond132.not, label %..critedge_crit_edge.us, label %29

.loopexit.us:                                     ; preds = %29, %..critedge_crit_edge.us
  %.185.us = phi i32 [ %spec.select.us, %..critedge_crit_edge.us ], [ %.084126.us, %29 ]
  %.1.us = phi i32 [ %spec.select122.us, %..critedge_crit_edge.us ], [ %.083127.us, %29 ]
  %37 = add nuw nsw i32 %.082128.us, 1
  %exitcond133.not = icmp eq i32 %37, 102
  br i1 %exitcond133.not, label %.split130.us, label %.lr.ph.us

..critedge_crit_edge.us:                          ; preds = %35
  %38 = sub i32 %.082128.us, %28
  %39 = call i32 @llvm.abs.i32(i32 %38, i1 false)
  %40 = icmp slt i32 %39, %.083127.us
  %spec.select.us = select i1 %40, i32 %.082128.us, i32 %.084126.us
  %spec.select122.us = call i32 @llvm.smin.i32(i32 %39, i32 %.083127.us)
  br label %.loopexit.us

.critedge:                                        ; preds = %18, %.critedge
  %.082128 = phi i32 [ %48, %.critedge ], [ 0, %18 ]
  %.083127 = phi i32 [ %spec.select122.1, %.critedge ], [ 1000, %18 ]
  %.084126 = phi i32 [ %spec.select.1, %.critedge ], [ undef, %18 ]
  %41 = sub i32 %.082128, %28
  %42 = call i32 @llvm.abs.i32(i32 %41, i1 false)
  %43 = icmp slt i32 %42, %.083127
  %spec.select = select i1 %43, i32 %.082128, i32 %.084126
  %spec.select122 = call i32 @llvm.smin.i32(i32 %42, i32 %.083127)
  %44 = or i32 %.082128, 1
  %45 = sub i32 %44, %28
  %46 = call i32 @llvm.abs.i32(i32 %45, i1 false)
  %47 = icmp slt i32 %46, %spec.select122
  %spec.select.1 = select i1 %47, i32 %44, i32 %spec.select
  %spec.select122.1 = call i32 @llvm.smin.i32(i32 %46, i32 %spec.select122)
  %48 = add nuw nsw i32 %.082128, 2
  %exitcond.not.1 = icmp eq i32 %48, 102
  br i1 %exitcond.not.1, label %.split130.us, label %.critedge

.split130.us:                                     ; preds = %.critedge, %.loopexit.us
  %.us-phi = phi i32 [ %.185.us, %.loopexit.us ], [ %spec.select.1, %.critedge ]
  %49 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.fc107ea821020307dcf6ff976d6c6cc0, i32 32)
  %50 = call i1 @_FortranAioOutputInteger32(ptr %49, i32 %.us-phi)
  %51 = call i32 @_FortranAioEndIoStatement(ptr %49)
  %52 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

declare i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #2

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { noreturn }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
