n,k=list(map(int,input().split()))

s=eval(input())

wa=[]

now=1

cnt=0

for i in range(n):

    if s[i]==str(0+now):

        cnt+=1

    else:

        wa.append(cnt)

        now=1-now

        cnt=1

if cnt!=0:

    wa.append(cnt)



if len(wa)%2==0:

    wa.append(0)



add=2*k+1

ans=0



left=0

right=0

tmp=0

for i in range(0,len(wa),2):

    nextleft=i

    nextright=min(i+add, len(wa))



    while nextleft > left:

        tmp-=wa[left]

        left+=1

    while nextright > right:

        tmp+=wa[right]

        right+=1



    ans=max(tmp,ans)

print(ans)

n,k=list(map(int,input().split()))

s=eval(input())

wa=[]

now=1

cnt=0

for i in range(n):

    if s[i]==str(0+now):

        cnt+=1

    else:

        wa.append(cnt)

        now=1-now

        cnt=1

if cnt!=0:

    wa.append(cnt)



if len(wa)%2==0:

    wa.append(0)



add=2*k+1

ans=0

s=[0]*(len(wa)+1)

for i in range(len(s)-1):

    s[i+1]=s[i]+wa[i]









for i in range(0,len(wa),2):

    left=i

    right=min(i+add, len(wa))

    tmp=s[right]-s[left]



    ans=max(tmp,ans)

print(ans)

n, k = list(map(int, input().split()))
s = eval(input())
wa = []
now = 1
cnt = 0
for i in range(n):
    if s[i] == str(0 + now):
        cnt += 1
    else:
        wa.append(cnt)
        now = 1 - now
        cnt = 1
if cnt != 0:
    wa.append(cnt)
if len(wa) % 2 == 0:
    wa.append(0)
add = 2 * k + 1
ans = 0
left = 0
right = 0
tmp = 0
for i in range(0, len(wa), 2):
    nextleft = i
    nextright = min(i + add, len(wa))
    while nextleft > left:
        tmp -= wa[left]
        left += 1
    while nextright > right:
        tmp += wa[right]
        right += 1
    ans = max(tmp, ans)
print(ans)

n, k = list(map(int, input().split()))
s = eval(input())
wa = []
now = 1
cnt = 0
for i in range(n):
    if s[i] == str(0 + now):
        cnt += 1
    else:
        wa.append(cnt)
        now = 1 - now
        cnt = 1
if cnt != 0:
    wa.append(cnt)
if len(wa) % 2 == 0:
    wa.append(0)
add = 2 * k + 1
ans = 0
s = [0] * (len(wa) + 1)
for i in range(len(s) - 1):
    s[i + 1] = s[i] + wa[i]
for i in range(0, len(wa), 2):
    left = i
    right = min(i + add, len(wa))
    tmp = s[right] - s[left]
    ans = max(tmp, ans)
print(ans)

-left = 0 -right = 0 -tmp = 0 +s = [0] * (len(wa) + 1) +for i in range(len(s) - 1): +    s[i + 1] = s[i] + wa[i] -    nextleft = i -    nextright = min(i + add, len(wa)) -    while nextleft > left: -        tmp -= wa[left] -        left += 1 -    while nextright > right: -        tmp += wa[right] -        right += 1 +    left = i +    right = min(i + add, len(wa)) +    tmp = s[right] - s[left]