      PROGRAM forbiddenList
      IMPLICIT NONE
      INTEGER,PARAMETER :: prec = 16
      integer(prec) :: x,n,ans,ansi,tempAns
      integer(prec), allocatable :: p(:)
      integer(prec) :: i, j
      
      read*,x,n
      allocate( p(n) )
      read*,p
      
      ans = 100000
      ansI = 10000
      
      outer:&
      do i = -200,300
        do j = 1,n
          if( i==p(j) )then
            cycle outer
          end if
        end do
        
        tempAns = abs( i-x )
        
        if( tempAns<=ans )then
          if( tempAns==ans )then
            if( i>ansI )then
              cycle outer
            end if
          end if
          
          ans = tempAns
          ansI = i
          
        end if
        
      end do outer
      
      print*,ansI
      
      
      
      stop
      !debugg
      
      print*,ans
      
      
      END PROGRAM
; 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.abe42eaa5a54db6f874476d3766021eb = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1204/source.f\00"
@_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 i128, align 8
  %3 = alloca i128, align 8
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.abe42eaa5a54db6f874476d3766021eb, i32 8)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 16)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 16)
  %7 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %8 = load i128, ptr %2, align 8, !tbaa !3
  %9 = trunc i128 %8 to i64
  %10 = call i64 @llvm.smax.i64(i64 %9, i64 0)
  %11 = shl i64 %10, 4
  %12 = call ptr @malloc(i64 %11)
  store ptr %12, ptr @_QFEp.0, align 8, !tbaa !7
  store i64 %10, ptr @_QFEp.8, align 8, !tbaa !7
  %13 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.abe42eaa5a54db6f874476d3766021eb, i32 10)
  %.unpack = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %.unpack107.unpack.unpack109 = 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 16, 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 11, 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 %.unpack107.unpack.unpack109, 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 16, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %14 = call i1 @_FortranAioInputDescriptor(ptr %13, ptr nonnull %1)
  %15 = call i32 @_FortranAioEndIoStatement(ptr %13)
  %16 = load i128, ptr %2, align 8, !tbaa !3
  %17 = icmp sgt i128 %16, 0
  %.unpack112 = load ptr, ptr @_QFEp.0, align 8
  %18 = load i128, ptr %3, align 8
  br i1 %17, label %.lr.ph.us, label %.split

.lr.ph.us:                                        ; preds = %0, %.loopexit.us
  %.086130.us = phi i128 [ %32, %.loopexit.us ], [ -200, %0 ]
  %.087129.us = phi i128 [ %.1.us, %.loopexit.us ], [ 10000, %0 ]
  %.088128.us = phi i128 [ %.189.us, %.loopexit.us ], [ 100000, %0 ]
  %.090127.us = phi i128 [ %31, %.loopexit.us ], [ 501, %0 ]
  br label %22

19:                                               ; preds = %._crit_edge.us
  %20 = icmp eq i128 %34, %.088128.us
  %21 = icmp sgt i128 %.086130.us, %.087129.us
  %or.cond.us = select i1 %20, i1 %21, i1 false
  %spec.select.us = select i1 %or.cond.us, i128 %.088128.us, i128 %34
  %spec.select124.us = select i1 %or.cond.us, i128 %.087129.us, i128 %.086130.us
  br label %.loopexit.us

22:                                               ; preds = %.lr.ph.us, %27
  %.0126.us = phi i128 [ %16, %.lr.ph.us ], [ %28, %27 ]
  %.085125.us = phi i64 [ 1, %.lr.ph.us ], [ %29, %27 ]
  %23 = add i64 %.085125.us, -1
  %24 = getelementptr i128, ptr %.unpack112, i64 %23
  %25 = load i128, ptr %24, align 8, !tbaa !3
  %26 = icmp eq i128 %.086130.us, %25
  br i1 %26, label %.loopexit.us, label %27

27:                                               ; preds = %22
  %28 = add nsw i128 %.0126.us, -1
  %29 = add i64 %.085125.us, 1
  %30 = icmp sgt i128 %.0126.us, 1
  br i1 %30, label %22, label %._crit_edge.us

.loopexit.us:                                     ; preds = %22, %19, %._crit_edge.us
  %.189.us = phi i128 [ %.088128.us, %._crit_edge.us ], [ %spec.select.us, %19 ], [ %.088128.us, %22 ]
  %.1.us = phi i128 [ %.087129.us, %._crit_edge.us ], [ %spec.select124.us, %19 ], [ %.087129.us, %22 ]
  %31 = add nsw i128 %.090127.us, -1
  %32 = add nsw i128 %.086130.us, 1
  %.not135 = icmp eq i128 %31, 0
  br i1 %.not135, label %.split132.us, label %.lr.ph.us

._crit_edge.us:                                   ; preds = %27
  %33 = sub i128 %.086130.us, %18
  %34 = call i128 @llvm.abs.i128(i128 %33, i1 false)
  %.not.us = icmp sgt i128 %34, %.088128.us
  br i1 %.not.us, label %.loopexit.us, label %19

.split:                                           ; preds = %0, %40
  %.086130 = phi i128 [ %42, %40 ], [ -200, %0 ]
  %.087129 = phi i128 [ %.1, %40 ], [ 10000, %0 ]
  %.088128 = phi i128 [ %.189, %40 ], [ 100000, %0 ]
  %.090127 = phi i128 [ %41, %40 ], [ 501, %0 ]
  %35 = sub i128 %.086130, %18
  %36 = call i128 @llvm.abs.i128(i128 %35, i1 false)
  %.not = icmp sgt i128 %36, %.088128
  br i1 %.not, label %40, label %37

37:                                               ; preds = %.split
  %38 = icmp eq i128 %36, %.088128
  %39 = icmp sgt i128 %.086130, %.087129
  %or.cond = select i1 %38, i1 %39, i1 false
  %spec.select = select i1 %or.cond, i128 %.088128, i128 %36
  %spec.select124 = select i1 %or.cond, i128 %.087129, i128 %.086130
  br label %40

40:                                               ; preds = %37, %.split
  %.189 = phi i128 [ %.088128, %.split ], [ %spec.select, %37 ]
  %.1 = phi i128 [ %.087129, %.split ], [ %spec.select124, %37 ]
  %41 = add nsw i128 %.090127, -1
  %42 = add nsw i128 %.086130, 1
  %.not134 = icmp eq i128 %41, 0
  br i1 %.not134, label %.split132.us, label %.split

.split132.us:                                     ; preds = %40, %.loopexit.us
  %.us-phi = phi i128 [ %.1.us, %.loopexit.us ], [ %.1, %40 ]
  %43 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.abe42eaa5a54db6f874476d3766021eb, i32 39)
  %44 = call i1 @_FortranAioOutputInteger128(ptr %43, i128 %.us-phi)
  %45 = call i32 @_FortranAioEndIoStatement(ptr %43)
  %46 = 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 i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger128(ptr, i128) local_unnamed_addr

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i128 @llvm.abs.i128(i128, i1 immarg) #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}
