program main
  implicit none
  integer :: n, m, i, pos, l, r, dice(100000), idice
  character(100001) :: s
  logical, allocatable :: ls(:)
  read *, n, m
  read *, s
  allocate (ls(0:n))
  do i = 0, n
    ls(i) = (s(i + 1:i + 1) == "0")
  end do
  pos = n
  idice = 0
  outer: do
    l = max(0, pos - m)
    r = pos - 1
    do i = l, r
      if (ls(i)) 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
  print "(100000(i0, ' '))", dice(idice:1:-1)
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
@_QFEls.0 = internal unnamed_addr global ptr null
@_QFEls.7 = internal unnamed_addr global i64 1
@_QFEs = internal global [100001 x i8] undef
@_QQcl.971a62a7b2a3c2cf096543fc27772d13 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_2929/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

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.971a62a7b2a3c2cf096543fc27772d13, i32 6)
  %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.971a62a7b2a3c2cf096543fc27772d13, i32 7)
  %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
  %12 = call i32 @llvm.smax.i32(i32 %11, i32 -1)
  %13 = sext i32 %12 to i64
  %14 = add nsw i64 %13, 1
  %15 = shl nuw nsw i64 %14, 2
  %16 = call ptr @malloc(i64 %15)
  %17 = icmp eq i64 %14, 0
  %18 = zext i1 %17 to i64
  store ptr %16, ptr @_QFEls.0, align 8, !tbaa !7
  store i64 %18, ptr @_QFEls.7, align 8, !tbaa !7
  %19 = icmp sgt i32 %11, -1
  br i1 %19, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %20 = zext i32 %11 to i64
  %21 = add nuw nsw i64 %20, 1
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %22 = phi i64 [ %21, %.lr.ph.preheader ], [ %31, %.lr.ph ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %sext = shl i64 %indvars.iv.next, 32
  %23 = ashr exact i64 %sext, 32
  %24 = add nsw i64 %23, -1
  %25 = getelementptr [100001 x [1 x i8]], ptr @_QFEs, i64 0, i64 %24
  %26 = call i32 @_FortranACharacterCompareScalar1(ptr %25, ptr nonnull @_QQcl.30, i64 1, i64 1)
  %27 = icmp eq i32 %26, 0
  %.unpack109 = load ptr, ptr @_QFEls.0, align 8, !tbaa !7
  %.unpack116.unpack.unpack = load i64, ptr @_QFEls.7, align 8, !tbaa !7
  %28 = sub i64 %indvars.iv, %.unpack116.unpack.unpack
  %29 = getelementptr i32, ptr %.unpack109, i64 %28
  %30 = zext i1 %27 to i32
  store i32 %30, ptr %29, align 4, !tbaa !3
  %31 = add nsw i64 %22, -1
  %32 = icmp ugt i64 %22, 1
  br i1 %32, label %.lr.ph, label %._crit_edge.loopexit

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr %3, align 4, !tbaa !3
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %0
  %.unpack104.unpack.unpack = phi i64 [ %.unpack116.unpack.unpack, %._crit_edge.loopexit ], [ %18, %0 ]
  %.unpack = phi ptr [ %.unpack109, %._crit_edge.loopexit ], [ %16, %0 ]
  %33 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %11, %0 ]
  %34 = load i32, ptr %2, align 4, !tbaa !3
  br label %35

35:                                               ; preds = %44, %._crit_edge
  %.087 = phi i32 [ 0, %._crit_edge ], [ %45, %44 ]
  %.085 = phi i32 [ %33, %._crit_edge ], [ %.086123, %44 ]
  %36 = sub i32 %.085, %34
  %37 = call i32 @llvm.smax.i32(i32 %36, i32 0)
  %38 = sub i32 %.085, %37
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %.lr.ph126, label %._crit_edge127

.lr.ph126:                                        ; preds = %35, %56
  %.0124 = phi i32 [ %57, %56 ], [ %38, %35 ]
  %.086123 = phi i32 [ %58, %56 ], [ %37, %35 ]
  %40 = sext i32 %.086123 to i64
  %41 = sub i64 %40, %.unpack104.unpack.unpack
  %42 = getelementptr i32, ptr %.unpack, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !3
  %.not = icmp eq i32 %43, 0
  br i1 %.not, label %56, label %44

44:                                               ; preds = %.lr.ph126
  %45 = add i32 %.087, 1
  %46 = sub i32 %.085, %.086123
  %47 = sext i32 %45 to i64
  %48 = add nsw i64 %47, -1
  %49 = getelementptr [100000 x i32], ptr @_QFEdice, i64 0, i64 %48
  store i32 %46, ptr %49, align 4, !tbaa !3
  %50 = icmp eq i32 %.086123, 0
  br i1 %50, label %52, label %35

common.ret:                                       ; preds = %._crit_edge127, %52
  %.sink = phi ptr [ %60, %._crit_edge127 ], [ %53, %52 ]
  %51 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  ret void

52:                                               ; preds = %44
  %53 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.283130303030302869302C202720272929, i64 17, ptr null, i32 -1, ptr nonnull @_QQcl.971a62a7b2a3c2cf096543fc27772d13, i32 32)
  %54 = call i64 @llvm.smax.i64(i64 %47, i64 0)
  store ptr %49, 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 %54, 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
  %55 = call i1 @_FortranAioOutputDescriptor(ptr %53, ptr nonnull %1)
  br label %common.ret

56:                                               ; preds = %.lr.ph126
  %57 = add nsw i32 %.0124, -1
  %58 = add nuw i32 %.086123, 1
  %59 = icmp sgt i32 %.0124, 1
  br i1 %59, label %.lr.ph126, label %._crit_edge127

._crit_edge127:                                   ; preds = %35, %56
  %60 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.971a62a7b2a3c2cf096543fc27772d13, i32 29)
  %61 = call i1 @_FortranAioOutputInteger32(ptr %60, 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 i64 @llvm.smax.i64(i64, i64) #1

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

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

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