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

sss = eval(input())



now = 1

cnt = 0

x = []



for i in range(n):

    if sss[i] == str(now):

        cnt += 1

    else:

        x.append(cnt)

        now = 1 - now

        cnt = 1

if cnt != 0:

    x.append(cnt)

if len(x) % 2 == 0:

    x.append(0)



Add = 2 * k + 1

ans = 0



left = 0

right = 0

tmp = 0



for i in range(len(x))[::2]:

    nextleft = i

    nextright = min(i + Add, len(x))

    while nextleft > left:

        tmp -= x[left]

        left += 1

    while nextright > right:

        tmp += x[right]

        right += 1

    

    ans = max(tmp, ans)



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

sss = eval(input())



now = 1

cnt = 0

x = []



for i in range(n):

    if sss[i] == str(now):

        cnt += 1

    else:

        x.append(cnt)

        now = 1 - now

        cnt = 1

if cnt != 0:

    x.append(cnt)

if len(x) % 2 == 0:

    x.append(0)



Add = 2 * k + 1

ans = 0



y = [0]

for i in range(len(x)):

    y.append(y[i] + x[i])



for i in range(len(x))[::2]:

    left = i

    right = min(i + Add, len(x))

    tmp = y[right] - y[left]    

    

    ans = max(tmp, ans)



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

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

-left = 0 -right = 0 -tmp = 0 +y = [0] +for i in range(len(x)): +    y.append(y[i] + x[i]) -    nextleft = i -    nextright = min(i + Add, len(x)) -    while nextleft > left: -        tmp -= x[left] -        left += 1 -    while nextright > right: -        tmp += x[right] -        right += 1 +    left = i +    right = min(i + Add, len(x)) +    tmp = y[right] - y[left]