program name
    implicit none
    integer(4):: n,k
    character(:),allocatable:: s
    integer(4):: cnt,i,ni,ans,l
    integer(4),allocatable:: si(:)

    read*, n,k
    allocate(character(n):: s)
    read*, s

    cnt=1
    do i=2,n
        if (s(i-1:i-1) /= s(i:i)) cnt=cnt+1
    end do

    allocate(si(cnt))

    ni=1
    si(:) = 0
    si(1) = 1
    do i=2,n
        if (s(i-1:i-1) /= s(i:i)) ni=ni+1
        si(ni) = si(ni)+1
    end do 

    if (s(1:1) == '0') then
        l = 2*k
    else
        l = 2*k+1
    end if

    ans=0
    do i=1,cnt,2
        ans = max(ans, sum(si(i:min(i+l-1,cnt))))
    end do

    print*, si(:)
end program name