program main
  implicit none
  integer N, K, renzokui, j, sakadatu, l, i
  integer renzoku(10**5), saidai(10**5)
  character(10**5) s
  character c, first
  read(*, *) N, K
  read(*, *) s
  s = trim(s)
  c = s(1:1)
  renzokui = 1
  j = 1
  do i=2,N-1
    if (s(i:i) /= c) then
      renzoku(j) = renzokui
      renzokui = 1
      j = j+1
      c = s(i:i)
    else
      renzokui = renzokui + 1
    end if
  end do
  if (s(N:N) /= c) then
    renzoku(j) = renzokui
    renzoku(j + 1) = 1
    j = j+1
  else
    renzoku(j) = renzokui + 1
  end if
  sakadatu = 1

  first = s(1:1)
  if (first == '0') then
    sakadatu = sum(renzoku( 1 : 2*K ))
    do i = 1,j-K+1
      l = sum(renzoku( 2*i : (2*i)+2*K ))
      if (sakadatu < l) then
        sakadatu = l
      endif
    end do
  else
    do i = 1,j-K+1
      l = sum(renzoku( 2*i-1 : (2*i-1)+2*K ))
      if (sakadatu < l) then
        sakadatu = l
      endif
    end do
  end if
  write(*, '(i0)') sakadatu
  !write(*, *) renzoku
end program main