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