program main
Implicit None
	integer(8)::n,k,i,p,q,a
	integer(8),allocatable::t(:),u(:)
	character(len=100000)::s
	
	read*,n,k
	read*,s
	
	p=1
	if(s(1:1) == "0")then
		p=p+1
	endif
	
	
	do i = 2,n
		if(s(i:i) /= s(i-1:i-1)) p = p+1
	enddo
	
	a = p
	
	allocate(t(p),u(a))
	
	p = 1
	q = 1
	if(s(1:1) == "0")then
		t(1) = 0
		q = q+1
	endif
	
	do i = 2,n
		if(s(i:i) == s(i-1:i-1))then
			p = p+1
			else
			t(q) = p
			p = 1
			q = q+1
		endif
	enddo
	t(q) = p
	
	do i =2,a
		t(i) = t(i-1)+t(i)
	enddo
	
	if(a/2 < k)then
		print"(i0)",n
		stop
	endif
	
	k = 2*k+1
	
	p = t(k)
	do i = 3,a-k+1,2
		if(p < t(k+i-1)-t(i-1)) p = t(k+i-1)-t(i-1)
	enddo
	
	print"(i0)",p
end program main