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

s = eval(input())

now = 1

cnt = 0

Nums = []

for i in range(len(s)):

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

        cnt += 1

    else:

        Nums.append(cnt)

        now = 1 - now

        cnt = 1

if cnt != 0:

    Nums.append(cnt)

if len(Nums) % 2 == 0:

    Nums.append(0)



ans = 0

Add = 2 * k + 1



left = 0

right = 0

tmp = 0



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

    Nextleft = i

    Nextright = min(i + Add, len(Nums))



    while Nextleft > left:

        tmp -= Nums[left]

        left += 1



    while Nextright > right:

        tmp += Nums[right]

        right += 1



    ans = max(tmp, ans)

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

s = eval(input())

now = 1

cnt = 0

Nums = []

for i in range(len(s)):

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

        cnt += 1

    else:

        Nums.append(cnt)

        now = 1 - now

        cnt = 1

if cnt != 0:

    Nums.append(cnt)

if len(Nums) % 2 == 0:

    Nums.append(0)



ans = 0

Add = 2 * k + 1



sum = [0] * (len(Nums) + 1)



for i in range(len(Nums)):

    sum[i + 1] = sum[i] + Nums[i]



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

    left = i

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

    tmp = sum[right] - sum[left]

    ans = max(tmp, ans)



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

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

-left = 0 -right = 0 -tmp = 0 +sum = [0] * (len(Nums) + 1) +for i in range(len(Nums)): +    sum[i + 1] = sum[i] + Nums[i] -    Nextleft = i -    Nextright = min(i + Add, len(Nums)) -    while Nextleft > left: -        tmp -= Nums[left] -        left += 1 -    while Nextright > right: -        tmp += Nums[right] -        right += 1 +    left = i +    right = min(i + Add, len(Nums)) +    tmp = sum[right] - sum[left]