program main
  implicit none
  integer :: n, k, j, l=2, res=1
  integer, allocatable :: i(:)
  character(100000) :: s

  read *, n, k
  read *, s
  allocate (i(2*n))
  i(:) = n + 1
  i(1) = 1

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

  do j = 1, n-1
    if (i(j) > n) exit
    if (s(i(j):i(j)) == '0') res = max(res, i(j+2*k)-i(j))
    if (s(i(j):i(j)) == '1') res = max(res, i(j+2*k+1)-i(j))
  end do

  print '(i0)', res

end program