PROGRAM ATCODER

implicit none
integer :: n,k,i,m,j
character(len=10**5) :: s
!!!! c_i(:) = 0と1が入れ替わるindex(1110ならindex=4が変わり目)
integer,allocatable :: c_i(:),ans(:) 

read*, n,k,s
allocate(c_i(n),ans(n))
c_i = n+1
c_i(1) = 1
ans = 0

if ( n == 1 ) then
  print'(i0)', 1
  stop
end if

i = 1
do m = 2, n
  if ( index(s(i:),'10') == 0 .and. index(s(i:),'01') == 0 ) then
    exit
  else if ( index(s(i:),'10') == 0 ) then
    j = index(s(i:),'01')
  else if ( index(s(i:),'01') == 0 ) then
    j = index(s(i:),'10')
  else
    j = min(index(s(i:),'10'),index(s(i:),'01'))
  end if
  c_i(m) = i + j
  i = i + j
end do

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

print'(i0)', maxval(ans)

END PROGRAM ATCODER