integer N,K
integer,allocatable,dimension(:)::a
logical,allocatable,dimension(:)::dp
read*,N,K
allocate(a(N),DP(0:K))
read*,a
DP=.False.
DP(0)=.False.
do i=1,K
  do j=1,N
    if(i-a(j)<0)cycle
    if(.Not.dp(i-a(j)))dp(i)=.True.
  end do
end do

print"(A)",merge(" First","Second",dp(k))

end
; 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"

@_QFEa.0 = internal unnamed_addr global ptr null
@_QFEa.8 = internal unnamed_addr global i64 0
@_QFEdp.0 = internal unnamed_addr global ptr null
@_QFEdp.7 = internal unnamed_addr global i64 1
@_QFEdp.8 = internal unnamed_addr global i64 0
@_QQcl.ff0ff8382bbd0947bae291131ffa67ba = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5201/source.f\00"
@_QQcl.16373402fa3425c6e46827601abb88fa = linkonce constant [76 x i8] c"array left hand side must be allocated when the right hand side is a scalar\00"
@_QQcl.284129 = linkonce constant [3 x i8] c"(A)"
@_QQcl.204669727374 = linkonce constant [6 x i8] c" First"
@_QQcl.5365636F6E64 = linkonce constant [6 x i8] c"Second"
@_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

define void @_QQmain() local_unnamed_addr {
  %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.ff0ff8382bbd0947bae291131ffa67ba, i32 4)
  %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 %3, align 4, !tbaa !3
  %9 = call i32 @llvm.smax.i32(i32 %8, i32 0)
  %10 = zext i32 %9 to i64
  %11 = shl nuw nsw i64 %10, 2
  %12 = call ptr @malloc(i64 %11)
  store ptr %12, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %10, ptr @_QFEa.8, align 8, !tbaa !7
  %13 = load i32, ptr %2, align 4, !tbaa !3
  %14 = call i32 @llvm.smax.i32(i32 %13, i32 -1)
  %15 = sext i32 %14 to i64
  %16 = add nsw i64 %15, 1
  %17 = shl nuw nsw i64 %16, 2
  %18 = call ptr @malloc(i64 %17)
  %19 = icmp eq i64 %16, 0
  %20 = zext i1 %19 to i64
  store ptr %18, ptr @_QFEdp.0, align 8, !tbaa !7
  store i64 %20, ptr @_QFEdp.7, align 8, !tbaa !7
  store i64 %16, ptr @_QFEdp.8, align 8, !tbaa !7
  %21 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.ff0ff8382bbd0947bae291131ffa67ba, i32 6)
  %.unpack = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack401.unpack.unpack403 = load i64, ptr @_QFEa.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 %.unpack401.unpack.unpack403, 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
  %22 = call i1 @_FortranAioInputDescriptor(ptr %21, ptr nonnull %1)
  %23 = call i32 @_FortranAioEndIoStatement(ptr %21)
  %.unpack406 = load ptr, ptr @_QFEdp.0, align 8, !tbaa !7
  %.unpack413.unpack.unpack415 = load i64, ptr @_QFEdp.8, align 8, !tbaa !7
  %.not = icmp eq ptr %.unpack406, null
  br i1 %.not, label %26, label %.preheader

.preheader:                                       ; preds = %0
  %24 = icmp sgt i64 %.unpack413.unpack.unpack415, 0
  br i1 %24, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %.preheader
  %25 = shl nuw i64 %.unpack413.unpack.unpack415, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %.unpack406, i8 0, i64 %25, i1 false), !tbaa !3
  br label %.loopexit

26:                                               ; preds = %0
  %27 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.ff0ff8382bbd0947bae291131ffa67ba, i32 7)
  %.unpack475.unpack.unpack = load i64, ptr @_QFEdp.7, align 8, !tbaa !7
  %28 = icmp eq i64 %.unpack413.unpack.unpack415, 0
  %29 = select i1 %28, i64 1, i64 %.unpack475.unpack.unpack
  store ptr null, ptr @_QFEdp.0, align 8, !tbaa !7
  store i64 %29, ptr @_QFEdp.7, align 8, !tbaa !7
  store i64 %.unpack413.unpack.unpack415, ptr @_QFEdp.8, align 8, !tbaa !7
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph.preheader, %.preheader, %26
  %.unpack425.unpack.unpack = load i64, ptr @_QFEdp.7, align 8, !tbaa !7
  %30 = sub i64 0, %.unpack425.unpack.unpack
  %31 = getelementptr i32, ptr %.unpack406, i64 %30
  store i32 0, ptr %31, align 4, !tbaa !3
  %32 = load i32, ptr %2, align 4, !tbaa !3
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %.lr.ph491, label %._crit_edge492

.lr.ph491:                                        ; preds = %.loopexit
  %34 = zext i32 %32 to i64
  %.unpack443 = load ptr, ptr @_QFEa.0, align 8
  br label %35

35:                                               ; preds = %.lr.ph491, %._crit_edge
  %indvars.iv494 = phi i64 [ 1, %.lr.ph491 ], [ %indvars.iv.next495, %._crit_edge ]
  %36 = load i32, ptr %3, align 4, !tbaa !3
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %.lr.ph489, label %._crit_edge

.lr.ph489:                                        ; preds = %35
  %38 = zext i32 %36 to i64
  %39 = sub i64 %indvars.iv494, %.unpack425.unpack.unpack
  %40 = getelementptr i32, ptr %.unpack406, i64 %39
  %41 = trunc i64 %indvars.iv494 to i32
  %xtraiter = and i64 %38, 1
  %42 = icmp eq i32 %36, 1
  br i1 %42, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph489.new

.lr.ph489.new:                                    ; preds = %.lr.ph489
  %unroll_iter = and i64 %38, 4294967294
  br label %43

43:                                               ; preds = %66, %.lr.ph489.new
  %indvars.iv = phi i64 [ 1, %.lr.ph489.new ], [ %indvars.iv.next.1, %66 ]
  %niter = phi i64 [ 0, %.lr.ph489.new ], [ %niter.next.1, %66 ]
  %44 = add nsw i64 %indvars.iv, -1
  %45 = getelementptr i32, ptr %.unpack443, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !3
  %47 = sub i32 %41, %46
  %48 = icmp sgt i32 %47, -1
  br i1 %48, label %49, label %55

49:                                               ; preds = %43
  %50 = zext i32 %47 to i64
  %51 = sub i64 %50, %.unpack425.unpack.unpack
  %52 = getelementptr i32, ptr %.unpack406, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !3
  %.not467 = icmp eq i32 %53, 0
  br i1 %.not467, label %54, label %55

54:                                               ; preds = %49
  store i32 1, ptr %40, align 4, !tbaa !3
  br label %55

55:                                               ; preds = %54, %49, %43
  %56 = getelementptr i32, ptr %.unpack443, i64 %indvars.iv
  %57 = load i32, ptr %56, align 4, !tbaa !3
  %58 = sub i32 %41, %57
  %59 = icmp sgt i32 %58, -1
  br i1 %59, label %60, label %66

60:                                               ; preds = %55
  %61 = zext i32 %58 to i64
  %62 = sub i64 %61, %.unpack425.unpack.unpack
  %63 = getelementptr i32, ptr %.unpack406, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !3
  %.not467.1 = icmp eq i32 %64, 0
  br i1 %.not467.1, label %65, label %66

65:                                               ; preds = %60
  store i32 1, ptr %40, align 4, !tbaa !3
  br label %66

66:                                               ; preds = %65, %60, %55
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %43

._crit_edge.loopexit.unr-lcssa:                   ; preds = %66, %.lr.ph489
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph489 ], [ %indvars.iv.next.1, %66 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa
  %67 = add nsw i64 %indvars.iv.unr, -1
  %68 = getelementptr i32, ptr %.unpack443, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !3
  %70 = sub i32 %41, %69
  %71 = icmp sgt i32 %70, -1
  br i1 %71, label %72, label %._crit_edge

72:                                               ; preds = %.epil.preheader
  %73 = zext i32 %70 to i64
  %74 = sub i64 %73, %.unpack425.unpack.unpack
  %75 = getelementptr i32, ptr %.unpack406, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !3
  %.not467.epil = icmp eq i32 %76, 0
  br i1 %.not467.epil, label %77, label %._crit_edge

77:                                               ; preds = %72
  store i32 1, ptr %40, align 4, !tbaa !3
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %77, %72, %.epil.preheader, %35
  %indvars.iv.next495 = add nuw nsw i64 %indvars.iv494, 1
  %exitcond497.not = icmp eq i64 %indvars.iv494, %34
  br i1 %exitcond497.not, label %._crit_edge492, label %35

._crit_edge492:                                   ; preds = %._crit_edge, %.loopexit
  %78 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.ff0ff8382bbd0947bae291131ffa67ba, i32 16)
  %.unpack430 = load ptr, ptr @_QFEdp.0, align 8, !tbaa !7
  %.unpack437.unpack.unpack = load i64, ptr @_QFEdp.7, align 8, !tbaa !7
  %79 = load i32, ptr %2, align 4, !tbaa !3
  %80 = sext i32 %79 to i64
  %81 = sub i64 %80, %.unpack437.unpack.unpack
  %82 = getelementptr i32, ptr %.unpack430, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !3
  %.not442 = icmp eq i32 %83, 0
  %84 = select i1 %.not442, ptr @_QQcl.5365636F6E64, ptr @_QQcl.204669727374
  %85 = call i1 @_FortranAioOutputAscii(ptr %78, ptr nonnull %84, i64 6)
  %86 = call i32 @_FortranAioEndIoStatement(ptr %78)
  ret void
}

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 {} @_FortranAReportFatalUserError(ptr, ptr, i32) local_unnamed_addr

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

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

!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}
