program main
  implicit none
  integer :: n, m, i, pos, l, r, dice(100000), idice
  character(100001) :: s
  read *, n, m
  read *, s
  pos = n
  idice = 0
  outer: do
    l = max(0, pos - m)
    r = pos - 1
    do i = l, r
      if (s(i + 1:i + 1) == "0") then
        idice = idice + 1
        dice(idice) = pos - i
        pos = i
        if (i == 0) then
          exit outer
        else
          cycle outer
        end if
      end if
    end do
    print "(i0)", -1
    return
  end do outer
  dice(1:idice) = dice(idice:1:-1)
  print "(100000(i0, ' '))", dice(1:idice)
end program main

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

@_QFEdice = internal global [100000 x i32] undef
@_QFEs = internal global [100001 x i8] undef
@_QQcl.4529b8ca0aa5908a83913901f77ae3f7 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_2928/source.f\00"
@_QQcl.30 = linkonce constant [1 x i8] c"0"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQcl.283130303030302869302C202720272929 = linkonce constant [17 x i8] c"(100000(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: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

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.4529b8ca0aa5908a83913901f77ae3f7, i32 5)
  %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 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.4529b8ca0aa5908a83913901f77ae3f7, i32 6)
  %9 = call i1 @_FortranAioInputAscii(ptr %8, ptr nonnull @_QFEs, i64 100001)
  %10 = call i32 @_FortranAioEndIoStatement(ptr %8)
  %11 = load i32, ptr %3, align 4, !tbaa !3
  br label %12

12:                                               ; preds = %27, %0
  %.018 = phi i32 [ 0, %0 ], [ %28, %27 ]
  %.016 = phi i32 [ %11, %0 ], [ %.01725, %27 ]
  %13 = load i32, ptr %2, align 4, !tbaa !3
  %14 = sub i32 %.016, %13
  %15 = call i32 @llvm.smax.i32(i32 %14, i32 0)
  %16 = sub i32 %.016, %15
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph, label %._crit_edge

18:                                               ; preds = %.lr.ph
  %19 = add nsw i32 %.026, -1
  %20 = icmp sgt i32 %.026, 1
  br i1 %20, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %12, %18
  %.026 = phi i32 [ %19, %18 ], [ %16, %12 ]
  %.01725 = phi i32 [ %21, %18 ], [ %15, %12 ]
  %21 = add nuw i32 %.01725, 1
  %22 = sext i32 %21 to i64
  %23 = add nsw i64 %22, -1
  %24 = getelementptr [100001 x [1 x i8]], ptr @_QFEs, i64 0, i64 %23
  %25 = call i32 @_FortranACharacterCompareScalar1(ptr %24, ptr nonnull @_QQcl.30, i64 1, i64 1)
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %18

27:                                               ; preds = %.lr.ph
  %28 = add i32 %.018, 1
  %29 = sub i32 %.016, %.01725
  %30 = sext i32 %28 to i64
  %31 = add nsw i64 %30, -1
  %32 = getelementptr [100000 x i32], ptr @_QFEdice, i64 0, i64 %31
  store i32 %29, ptr %32, align 4, !tbaa !3
  %33 = icmp eq i32 %.01725, 0
  br i1 %33, label %.preheader22, label %12

.preheader22:                                     ; preds = %27
  %34 = call dereferenceable_or_null(400000) ptr @malloc(i64 400000)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(400000) %34, ptr noundef nonnull align 16 dereferenceable(400000) @_QFEdice, i64 400000, i1 false), !tbaa !3
  %35 = call i64 @llvm.smax.i64(i64 %30, i64 0)
  %.not = icmp ugt i32 %.018, 2147483646
  br i1 %.not, label %.preheader, label %.lr.ph28.preheader

.lr.ph28.preheader:                               ; preds = %.preheader22
  %min.iters.check = icmp ult i64 %35, 8
  br i1 %min.iters.check, label %.lr.ph28.preheader47, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph28.preheader
  %n.vec = and i64 %35, 9223372036854775800
  %ind.end = and i64 %35, 7
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %36 = sub nsw i64 %31, %index
  %37 = getelementptr i32, ptr @_QFEdice, i64 %36
  %38 = getelementptr i32, ptr %37, i64 -3
  %wide.load = load <4 x i32>, ptr %38, align 4, !tbaa !3
  %reverse = shufflevector <4 x i32> %wide.load, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %39 = getelementptr i32, ptr %37, i64 -4
  %40 = getelementptr i32, ptr %39, i64 -3
  %wide.load45 = load <4 x i32>, ptr %40, align 4, !tbaa !3
  %reverse46 = shufflevector <4 x i32> %wide.load45, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %41 = getelementptr i32, ptr %34, i64 %index
  store <4 x i32> %reverse, ptr %41, align 4, !tbaa !3
  %42 = getelementptr i32, ptr %41, i64 4
  store <4 x i32> %reverse46, ptr %42, align 4, !tbaa !3
  %index.next = add nuw i64 %index, 8
  %43 = icmp eq i64 %index.next, %n.vec
  br i1 %43, label %middle.block, label %vector.body, !llvm.loop !7

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %35, %n.vec
  br i1 %cmp.n, label %.preheader, label %.lr.ph28.preheader47

.lr.ph28.preheader47:                             ; preds = %.lr.ph28.preheader, %middle.block
  %.ph = phi i64 [ %35, %.lr.ph28.preheader ], [ %ind.end, %middle.block ]
  %.ph48 = phi i64 [ 0, %.lr.ph28.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph28

.preheader:                                       ; preds = %.lr.ph28, %middle.block, %.preheader22
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) @_QFEdice, ptr noundef nonnull align 4 dereferenceable(400000) %34, i64 400000, i1 false), !tbaa !3
  call void @free(ptr nonnull %34)
  %44 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.283130303030302869302C202720272929, i64 17, ptr null, i32 -1, ptr nonnull @_QQcl.4529b8ca0aa5908a83913901f77ae3f7, i32 28)
  store ptr @_QFEdice, ptr %1, align 8, !tbaa !10
  %.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 !10
  %.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 !10
  %.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 !10
  %.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 !10
  %.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 !10
  %.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 !10
  %.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 !10
  %.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 %35, ptr %.fca.7.0.1.gep, align 8, !tbaa !10
  %.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 !10
  %45 = call i1 @_FortranAioOutputDescriptor(ptr %44, ptr nonnull %1)
  br label %common.ret

.lr.ph28:                                         ; preds = %.lr.ph28.preheader47, %.lr.ph28
  %46 = phi i64 [ %53, %.lr.ph28 ], [ %.ph, %.lr.ph28.preheader47 ]
  %47 = phi i64 [ %48, %.lr.ph28 ], [ %.ph48, %.lr.ph28.preheader47 ]
  %48 = add nuw nsw i64 %47, 1
  %49 = sub nsw i64 %31, %47
  %50 = getelementptr i32, ptr @_QFEdice, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !3
  %52 = getelementptr i32, ptr %34, i64 %47
  store i32 %51, ptr %52, align 4, !tbaa !3
  %53 = add nsw i64 %46, -1
  %54 = icmp ugt i64 %46, 1
  br i1 %54, label %.lr.ph28, label %.preheader, !llvm.loop !12

common.ret:                                       ; preds = %._crit_edge, %.preheader
  %.sink = phi ptr [ %56, %._crit_edge ], [ %44, %.preheader ]
  %55 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  ret void

._crit_edge:                                      ; preds = %12, %18
  %56 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.4529b8ca0aa5908a83913901f77ae3f7, i32 24)
  %57 = call i1 @_FortranAioOutputInteger32(ptr %56, i32 -1)
  br label %common.ret
}

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 @_FortranAioInputAscii(ptr, ptr, i64) local_unnamed_addr

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

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

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputDescriptor(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 i64 @llvm.smax.i64(i64, i64) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

!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 = distinct !{!7, !8, !9}
!8 = !{!"llvm.loop.isvectorized", i32 1}
!9 = !{!"llvm.loop.unroll.runtime.disable"}
!10 = !{!11, !11, i64 0}
!11 = !{!"descriptor member", !5, i64 0}
!12 = distinct !{!12, !9, !8}
