integer N,K
character(10**5) S
integer a(0:10**5),b(0:10**5)
integer asoeji,bsoeji
integer ans
read*,N,K
read*,S
a=0
b=0
if(S(1:1)=="1")then
  asoeji=1
  a(asoeji)=1
  bsoeji=0
else
  asoeji=1
  a(asoeji)=0
  bsoeji=1
  b(bsoeji)=1
endif
do i=2,N
  if(S(i:i)==S(i-1:i-1))then
    if(S(i:i)=="1")a(asoeji)=a(asoeji)+1
    if(S(i:i)=="0")b(bsoeji)=b(asoeji)+1
  else
    if(S(i:i)=="1")then
      asoeji=asoeji+1
      a(asoeji)=1
    else
      bsoeji=bsoeji+1
      b(bsoeji)=1
    endif
  endif
end do
ans=0
do i=1,bsoeji+1
  ans=max(ans,sum(a(i:i+k))+sum(b(i:i+k-1)) )
end do
print"(I0)",ans
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 = internal unnamed_addr global [100001 x i32] undef
@_QFEb = internal unnamed_addr global [100001 x i32] undef
@_QFEs = internal global [100000 x i8] undef
@_QQcl.ce4d22bb0f5080f19246f0840035be0f = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4510/source.f\00"
@_QQcl.31 = linkonce constant [1 x i8] c"1"
@_QQcl.30 = linkonce constant [1 x i8] c"0"
@_QQcl.28493029 = linkonce constant [4 x i8] c"(I0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
.preheader.preheader:
  %0 = alloca i32, align 4
  %1 = alloca i32, align 4
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.ce4d22bb0f5080f19246f0840035be0f, i32 6)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 4)
  %4 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %0, i32 4)
  %5 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %6 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.ce4d22bb0f5080f19246f0840035be0f, i32 7)
  %7 = call i1 @_FortranAioInputAscii(ptr %6, ptr nonnull @_QFEs, i64 100000)
  %8 = call i32 @_FortranAioEndIoStatement(ptr %6)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400004) @_QFEa, i8 0, i64 400004, i1 false), !tbaa !3
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400004) @_QFEb, i8 0, i64 400004, i1 false), !tbaa !3
  %9 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull @_QFEs, ptr nonnull @_QQcl.31, i64 1, i64 1)
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %12, label %11

11:                                               ; preds = %.preheader.preheader
  store i32 1, ptr getelementptr inbounds ([100001 x i32], ptr @_QFEb, i64 0, i64 1), align 4, !tbaa !3
  br label %12

12:                                               ; preds = %.preheader.preheader, %11
  %.sink = phi i32 [ 0, %11 ], [ 1, %.preheader.preheader ]
  %.0 = phi i32 [ 1, %11 ], [ 0, %.preheader.preheader ]
  store i32 %.sink, ptr getelementptr inbounds ([100001 x i32], ptr @_QFEa, i64 0, i64 1), align 4
  %13 = load i32, ptr %1, align 4, !tbaa !3
  %14 = icmp sgt i32 %13, 1
  br i1 %14, label %.lr.ph.preheader, label %.lr.ph69

.lr.ph.preheader:                                 ; preds = %12
  %15 = zext i32 %13 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %45
  %indvars.iv = phi i64 [ 2, %.lr.ph.preheader ], [ %indvars.iv.next, %45 ]
  %.166 = phi i32 [ %.0, %.lr.ph.preheader ], [ %.2, %45 ]
  %.14265 = phi i32 [ 1, %.lr.ph.preheader ], [ %.243, %45 ]
  %16 = add nsw i64 %indvars.iv, -1
  %17 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %16
  %18 = add nsw i64 %indvars.iv, -2
  %19 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %18
  %20 = call i32 @_FortranACharacterCompareScalar1(ptr %17, ptr %19, i64 1, i64 1)
  %21 = icmp eq i32 %20, 0
  %22 = call i32 @_FortranACharacterCompareScalar1(ptr %17, ptr nonnull @_QQcl.31, i64 1, i64 1)
  %23 = icmp eq i32 %22, 0
  br i1 %21, label %24, label %38

24:                                               ; preds = %.lr.ph
  br i1 %23, label %25, label %30

25:                                               ; preds = %24
  %26 = sext i32 %.14265 to i64
  %27 = getelementptr [100001 x i32], ptr @_QFEa, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !3
  %29 = add i32 %28, 1
  store i32 %29, ptr %27, align 4, !tbaa !3
  br label %30

30:                                               ; preds = %25, %24
  %31 = call i32 @_FortranACharacterCompareScalar1(ptr %17, ptr nonnull @_QQcl.30, i64 1, i64 1)
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %45

33:                                               ; preds = %30
  %34 = sext i32 %.14265 to i64
  %35 = getelementptr [100001 x i32], ptr @_QFEb, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !3
  %37 = add i32 %36, 1
  br label %.sink.split

38:                                               ; preds = %.lr.ph
  br i1 %23, label %39, label %41

39:                                               ; preds = %38
  %40 = add i32 %.14265, 1
  br label %.sink.split

41:                                               ; preds = %38
  %42 = add i32 %.166, 1
  br label %.sink.split

.sink.split:                                      ; preds = %41, %39, %33
  %.166.sink = phi i32 [ %.166, %33 ], [ %40, %39 ], [ %42, %41 ]
  %_QFEb.sink = phi ptr [ @_QFEb, %33 ], [ @_QFEa, %39 ], [ @_QFEb, %41 ]
  %.sink82 = phi i32 [ %37, %33 ], [ 1, %39 ], [ 1, %41 ]
  %.243.ph = phi i32 [ %.14265, %33 ], [ %40, %39 ], [ %.14265, %41 ]
  %.2.ph = phi i32 [ %.166, %33 ], [ %.166, %39 ], [ %42, %41 ]
  %43 = sext i32 %.166.sink to i64
  %44 = getelementptr [100001 x i32], ptr %_QFEb.sink, i64 0, i64 %43
  store i32 %.sink82, ptr %44, align 4, !tbaa !3
  br label %45

45:                                               ; preds = %.sink.split, %30
  %.243 = phi i32 [ %.14265, %30 ], [ %.243.ph, %.sink.split ]
  %.2 = phi i32 [ %.166, %30 ], [ %.2.ph, %.sink.split ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %15
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %45
  %46 = icmp ult i32 %.2, 2147483647
  br i1 %46, label %.lr.ph69, label %._crit_edge70

.lr.ph69:                                         ; preds = %12, %._crit_edge
  %.1.lcssa79 = phi i32 [ %.2, %._crit_edge ], [ %.0, %12 ]
  %47 = add nuw nsw i32 %.1.lcssa79, 1
  %48 = zext i32 %47 to i64
  %49 = load i32, ptr %0, align 4, !tbaa !3
  %50 = add i32 %49, 1
  br label %51

51:                                               ; preds = %.lr.ph69, %_FortranASumInteger4x1_contract_simplified.exit52
  %indvar = phi i64 [ 0, %.lr.ph69 ], [ %indvar.next, %_FortranASumInteger4x1_contract_simplified.exit52 ]
  %indvars.iv75 = phi i64 [ 1, %.lr.ph69 ], [ %indvars.iv.next76, %_FortranASumInteger4x1_contract_simplified.exit52 ]
  %52 = phi i64 [ %48, %.lr.ph69 ], [ %106, %_FortranASumInteger4x1_contract_simplified.exit52 ]
  %.04467 = phi i32 [ 0, %.lr.ph69 ], [ %105, %_FortranASumInteger4x1_contract_simplified.exit52 ]
  %53 = xor i64 %indvar, -1
  %54 = trunc i64 %indvar to i32
  %55 = add i32 %50, %54
  %56 = sext i32 %55 to i64
  %57 = add nsw i64 %53, %56
  %smax89 = call i64 @llvm.smax.i64(i64 %57, i64 -1)
  %58 = add nsw i64 %smax89, 1
  %59 = xor i64 %indvar, -1
  %60 = trunc i64 %indvar to i32
  %61 = add i32 %49, %60
  %62 = sext i32 %61 to i64
  %63 = add i64 %59, %62
  %smax = call i64 @llvm.smax.i64(i64 %63, i64 -1)
  %64 = add nsw i64 %smax, 1
  %65 = trunc i64 %indvars.iv75 to i32
  %66 = add i32 %49, %65
  %67 = sext i32 %66 to i64
  %68 = sub nsw i64 %67, %indvars.iv75
  %69 = call i64 @llvm.smax.i64(i64 %68, i64 -1)
  %70 = getelementptr [100001 x i32], ptr @_QFEa, i64 0, i64 %indvars.iv75
  %.not = icmp slt i64 %68, 0
  br i1 %.not, label %_FortranASumInteger4x1_contract_simplified.exit, label %.lr.ph.i.preheader

.lr.ph.i.preheader:                               ; preds = %51
  %min.iters.check92 = icmp ult i64 %58, 8
  br i1 %min.iters.check92, label %.lr.ph.i.preheader109, label %vector.ph93

vector.ph93:                                      ; preds = %.lr.ph.i.preheader
  %n.vec95 = and i64 %58, -8
  br label %vector.body98

vector.body98:                                    ; preds = %vector.body98, %vector.ph93
  %index99 = phi i64 [ 0, %vector.ph93 ], [ %index.next104, %vector.body98 ]
  %vec.phi100 = phi <4 x i32> [ zeroinitializer, %vector.ph93 ], [ %74, %vector.body98 ]
  %vec.phi101 = phi <4 x i32> [ zeroinitializer, %vector.ph93 ], [ %75, %vector.body98 ]
  %71 = shl i64 %index99, 2
  %72 = getelementptr i8, ptr %70, i64 %71
  %wide.load102 = load <4 x i32>, ptr %72, align 4, !tbaa !3
  %73 = getelementptr i32, ptr %72, i64 4
  %wide.load103 = load <4 x i32>, ptr %73, align 4, !tbaa !3
  %74 = add <4 x i32> %wide.load102, %vec.phi100
  %75 = add <4 x i32> %wide.load103, %vec.phi101
  %index.next104 = add nuw i64 %index99, 8
  %76 = icmp eq i64 %index.next104, %n.vec95
  br i1 %76, label %middle.block90, label %vector.body98, !llvm.loop !7

middle.block90:                                   ; preds = %vector.body98
  %bin.rdx105 = add <4 x i32> %75, %74
  %77 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx105)
  %cmp.n97 = icmp eq i64 %58, %n.vec95
  br i1 %cmp.n97, label %_FortranASumInteger4x1_contract_simplified.exit, label %.lr.ph.i.preheader109

.lr.ph.i.preheader109:                            ; preds = %.lr.ph.i.preheader, %middle.block90
  %.ph110 = phi i32 [ 0, %.lr.ph.i.preheader ], [ %77, %middle.block90 ]
  %.ph111 = phi i64 [ 0, %.lr.ph.i.preheader ], [ %n.vec95, %middle.block90 ]
  br label %.lr.ph.i

.lr.ph.i:                                         ; preds = %.lr.ph.i.preheader109, %.lr.ph.i
  %78 = phi i32 [ %83, %.lr.ph.i ], [ %.ph110, %.lr.ph.i.preheader109 ]
  %79 = phi i64 [ %84, %.lr.ph.i ], [ %.ph111, %.lr.ph.i.preheader109 ]
  %80 = shl i64 %79, 2
  %81 = getelementptr i8, ptr %70, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !3
  %83 = add i32 %82, %78
  %84 = add nuw nsw i64 %79, 1
  %exitcond.not.i = icmp eq i64 %79, %69
  br i1 %exitcond.not.i, label %_FortranASumInteger4x1_contract_simplified.exit, label %.lr.ph.i, !llvm.loop !10

_FortranASumInteger4x1_contract_simplified.exit:  ; preds = %.lr.ph.i, %middle.block90, %51
  %.lcssa.i = phi i32 [ 0, %51 ], [ %77, %middle.block90 ], [ %83, %.lr.ph.i ]
  %85 = add i32 %66, -1
  %86 = sext i32 %85 to i64
  %87 = sub nsw i64 %86, %indvars.iv75
  %88 = call i64 @llvm.smax.i64(i64 %87, i64 -1)
  %89 = getelementptr [100001 x i32], ptr @_QFEb, i64 0, i64 %indvars.iv75
  %.not63 = icmp slt i64 %87, 0
  br i1 %.not63, label %_FortranASumInteger4x1_contract_simplified.exit52, label %.lr.ph.i49.preheader

.lr.ph.i49.preheader:                             ; preds = %_FortranASumInteger4x1_contract_simplified.exit
  %min.iters.check = icmp ult i64 %64, 8
  br i1 %min.iters.check, label %.lr.ph.i49.preheader107, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.i49.preheader
  %n.vec = and i64 %64, -8
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %93, %vector.body ]
  %vec.phi87 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %94, %vector.body ]
  %90 = shl i64 %index, 2
  %91 = getelementptr i8, ptr %89, i64 %90
  %wide.load = load <4 x i32>, ptr %91, align 4, !tbaa !3
  %92 = getelementptr i32, ptr %91, i64 4
  %wide.load88 = load <4 x i32>, ptr %92, align 4, !tbaa !3
  %93 = add <4 x i32> %wide.load, %vec.phi
  %94 = add <4 x i32> %wide.load88, %vec.phi87
  %index.next = add nuw i64 %index, 8
  %95 = icmp eq i64 %index.next, %n.vec
  br i1 %95, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %94, %93
  %96 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %64, %n.vec
  br i1 %cmp.n, label %_FortranASumInteger4x1_contract_simplified.exit52, label %.lr.ph.i49.preheader107

.lr.ph.i49.preheader107:                          ; preds = %.lr.ph.i49.preheader, %middle.block
  %.ph = phi i32 [ 0, %.lr.ph.i49.preheader ], [ %96, %middle.block ]
  %.ph108 = phi i64 [ 0, %.lr.ph.i49.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph.i49

.lr.ph.i49:                                       ; preds = %.lr.ph.i49.preheader107, %.lr.ph.i49
  %97 = phi i32 [ %102, %.lr.ph.i49 ], [ %.ph, %.lr.ph.i49.preheader107 ]
  %98 = phi i64 [ %103, %.lr.ph.i49 ], [ %.ph108, %.lr.ph.i49.preheader107 ]
  %99 = shl i64 %98, 2
  %100 = getelementptr i8, ptr %89, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !3
  %102 = add i32 %101, %97
  %103 = add nuw nsw i64 %98, 1
  %exitcond.not.i50 = icmp eq i64 %98, %88
  br i1 %exitcond.not.i50, label %_FortranASumInteger4x1_contract_simplified.exit52, label %.lr.ph.i49, !llvm.loop !12

_FortranASumInteger4x1_contract_simplified.exit52: ; preds = %.lr.ph.i49, %middle.block, %_FortranASumInteger4x1_contract_simplified.exit
  %.lcssa.i51 = phi i32 [ 0, %_FortranASumInteger4x1_contract_simplified.exit ], [ %96, %middle.block ], [ %102, %.lr.ph.i49 ]
  %104 = add i32 %.lcssa.i51, %.lcssa.i
  %105 = call i32 @llvm.smax.i32(i32 %.04467, i32 %104)
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %106 = add nsw i64 %52, -1
  %107 = icmp sgt i64 %52, 1
  %indvar.next = add i64 %indvar, 1
  br i1 %107, label %51, label %._crit_edge70

._crit_edge70:                                    ; preds = %_FortranASumInteger4x1_contract_simplified.exit52, %._crit_edge
  %.044.lcssa = phi i32 [ 0, %._crit_edge ], [ %105, %_FortranASumInteger4x1_contract_simplified.exit52 ]
  %108 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28493029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.ce4d22bb0f5080f19246f0840035be0f, i32 38)
  %109 = call i1 @_FortranAioOutputInteger32(ptr %108, i32 %.044.lcssa)
  %110 = call i32 @_FortranAioEndIoStatement(ptr %108)
  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 @_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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #2

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nosync nounwind 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 = distinct !{!7, !8, !9}
!8 = !{!"llvm.loop.isvectorized", i32 1}
!9 = !{!"llvm.loop.unroll.runtime.disable"}
!10 = distinct !{!10, !9, !8}
!11 = distinct !{!11, !8, !9}
!12 = distinct !{!12, !9, !8}
