_, K = list(map(int, input().split()))

S = eval(input())



offset = not (int(S[0]) ^ (K & 1))

runs = []



prev = S[0]

run = 0

for c in S:

    if c != prev:

        runs.append(run)

        run = 0

    prev = c

    run += 1

runs.append(run)



L = len(runs)

candidates = []



prev = sum(runs[max(0, offset - K): min(L, offset + K + 1)])

answer = prev



for i in range(offset + 2, L, 2):

    now = prev

    old_left = i - 2 - K

    new_right = i + K

    if old_left >= 0:

        now -= runs[old_left]

    if old_left + 1 >= 0:

        now -= runs[old_left + 1]

    if new_right - 1 < L:

        now += runs[new_right - 1]

    if new_right < L:

        now += runs[new_right]

    prev = now

    answer = max(answer, prev)



print(answer)

_, K = list(map(int, input().split()))

S = eval(input())



offset = not (int(S[0]) ^ (K & 1))

runs = []



prev = S[0]

run = 0

for c in S:

    if c != prev:

        runs.append(run)

        run = 0

    prev = c

    run += 1

runs.append(run)



L = len(runs)

candidates = []



prev = sum(runs[max(0, offset - K): min(L, offset + K + 1)])

answer = prev



for i in range(offset + 2, L, 2):

    now = prev

    old_left = i - 2 - K

    new_right = i + K

    if old_left >= 0:

        now -= runs[old_left]

    if old_left + 1 >= 0:

        now -= runs[old_left + 1]

    if new_right - 1 < L:

        now += runs[new_right - 1]

    if new_right < L:

        now += runs[new_right]

    prev = now

    if prev > answer:

        answer = prev



print(answer)

_, K = list(map(int, input().split()))
S = eval(input())
offset = not (int(S[0]) ^ (K & 1))
runs = []
prev = S[0]
run = 0
for c in S:
    if c != prev:
        runs.append(run)
        run = 0
    prev = c
    run += 1
runs.append(run)
L = len(runs)
candidates = []
prev = sum(runs[max(0, offset - K) : min(L, offset + K + 1)])
answer = prev
for i in range(offset + 2, L, 2):
    now = prev
    old_left = i - 2 - K
    new_right = i + K
    if old_left >= 0:
        now -= runs[old_left]
    if old_left + 1 >= 0:
        now -= runs[old_left + 1]
    if new_right - 1 < L:
        now += runs[new_right - 1]
    if new_right < L:
        now += runs[new_right]
    prev = now
    answer = max(answer, prev)
print(answer)

_, K = list(map(int, input().split()))
S = eval(input())
offset = not (int(S[0]) ^ (K & 1))
runs = []
prev = S[0]
run = 0
for c in S:
    if c != prev:
        runs.append(run)
        run = 0
    prev = c
    run += 1
runs.append(run)
L = len(runs)
candidates = []
prev = sum(runs[max(0, offset - K) : min(L, offset + K + 1)])
answer = prev
for i in range(offset + 2, L, 2):
    now = prev
    old_left = i - 2 - K
    new_right = i + K
    if old_left >= 0:
        now -= runs[old_left]
    if old_left + 1 >= 0:
        now -= runs[old_left + 1]
    if new_right - 1 < L:
        now += runs[new_right - 1]
    if new_right < L:
        now += runs[new_right]
    prev = now
    if prev > answer:
        answer = prev
print(answer)

-    answer = max(answer, prev) +    if prev > answer: +        answer = prev