program main
  implicit none
  integer :: n, k, i, j, p
  character(100000) :: s
  integer, allocatable :: jmax(:)
  read *, n, k
  read *, s

  allocate (jmax(n))
  j = 1
  p = 0
  if (s(1:1) == "0") p = 1
  do i = 1, n
    if (j < i) then
      j = i
      p = 0
      if (s(i:i) == "0") p = 1
    end if
    do while (j < n)
      if (s(j:j + 1) == "10" .and. p >= k) exit
      if (s(j:j + 1) == "10") p = p + 1
      j = j + 1
    end do

    jmax(i) = j
    if (i < n .and. s(i:i + 1) == "01") p = p - 1
  end do
  do i = 1, n
    jmax(i) = jmax(i) - i + 1
  end do
  print "(i0)", maxval(jmax)
end program main
