PROGRAM ATCODER

implicit none
integer(16) :: n,k,i,j
integer(16),allocatable :: c(:),ans(:)
character(len=10**5) :: s

read*, n,k,s
allocate(c(n+2*k+1),ans(n))
c = n + 1
c(1) = 1
ans = 1

!! c(:)は0か1が連続する区間の始点
j = 2
do i = 1, n-1, 1
  if ( s(i:i+1) == '01' .or. s(i:i+1) == '10' ) then
    c(j) = i+1
    j = j + 1
  end if
end do

do i = 1, n-1, 1
  if ( s(c(i):c(i)) == '0' ) then
    ans(i) = c(i+2*k) - c(i)
  else
    ans(i) = c(i+2*k+1) - c(i)
  end if
end do

print'(i0)', maxval(ans)

END PROGRAM ATCODER