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=2
    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))then
            ni=ni+1
            si(ni) = i
        end if
    end do
    si(cnt) = n+1

    ans = 0
    do i=1,cnt-1
        if (s(si(i):si(i)) == '0') then
            l = (2*k)
        else
            l = 2*k+1
        end if
        ans = max(ans, si(min(cnt,l+i))-si(i))
    end do
    print*, ans
end program name