integer N,K
character(10**5) S
integer a(0:10**5),b(0:10**5)
integer asoeji,bsoeji
integer ans
read*,N,K
read*,S
a=0
b=0
if(S(1:1)=="1")then
  asoeji=1
  a(asoeji)=1
  bsoeji=0
else
  asoeji=1
  a(asoeji)=0
  bsoeji=1
  b(bsoeji)=1
endif
do i=2,N
  if(S(i:i)==S(i-1:i-1))then
    if(S(i:i)=="1")a(asoeji)=a(asoeji)+1
    if(S(i:i)=="0")b(bsoeji)=b(asoeji)+1
  else
    if(S(i:i)=="1")then
      asoeji=asoeji+1
      a(asoeji)=1
    else
      bsoeji=bsoeji+1
      b(bsoeji)=1
    endif
  endif
end do
ans=0
do i=1,bsoeji+1
  ans=max(ans,sum(a(i:i+k))+sum(b(i:i+k-1)) )
end do
print"(I0)",ans
end