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

s = eval(input())



prev_R = '1'

for R in range(n):

    if (prev_R, s[R]) == ('1', '0'):

        k -= 1

        if k < 0:

            R -= 1

            break

    prev_R = s[R]



ans = R+1

for L in range(n-1):

    if (s[L], s[L+1]) != ('0', '1'):

        continue

    R += 1

    while R < n-1 and (s[R], s[R+1]) != ('1', '0'):

        R += 1

    if ans < R-L:

        ans = R-L

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

s = list(eval(input()))





L = [0]

R = []

for i, (a, b) in enumerate(zip(s, s[1:])):

    if (a, b) == ('0', '1'):

        L.append(i+1)



    if (a, b) == ('1', '0'):

        R.append(i)

else:

    R.append(n-1)



ans = R[0]-L[0]+1

if s[0] == '0':

    k -= 1

k = min(k, len(R)-1)

for l, r in zip(L, R[k:]):

    x = r-l+1

    if ans < x:

        ans = x

print(ans)

n, k = list(map(int, input().split()))
s = eval(input())
prev_R = "1"
for R in range(n):
    if (prev_R, s[R]) == ("1", "0"):
        k -= 1
        if k < 0:
            R -= 1
            break
    prev_R = s[R]
ans = R + 1
for L in range(n - 1):
    if (s[L], s[L + 1]) != ("0", "1"):
        continue
    R += 1
    while R < n - 1 and (s[R], s[R + 1]) != ("1", "0"):
        R += 1
    if ans < R - L:
        ans = R - L
print(ans)

n, k = list(map(int, input().split()))
s = list(eval(input()))
L = [0]
R = []
for i, (a, b) in enumerate(zip(s, s[1:])):
    if (a, b) == ("0", "1"):
        L.append(i + 1)
    if (a, b) == ("1", "0"):
        R.append(i)
else:
    R.append(n - 1)
ans = R[0] - L[0] + 1
if s[0] == "0":
    k -= 1
k = min(k, len(R) - 1)
for l, r in zip(L, R[k:]):
    x = r - l + 1
    if ans < x:
        ans = x
print(ans)

-s = eval(input()) -prev_R = "1" -for R in range(n): -    if (prev_R, s[R]) == ("1", "0"): -        k -= 1 -        if k < 0: -            R -= 1 -            break -    prev_R = s[R] -ans = R + 1 -for L in range(n - 1): -    if (s[L], s[L + 1]) != ("0", "1"): -        continue -    R += 1 -    while R < n - 1 and (s[R], s[R + 1]) != ("1", "0"): -        R += 1 -    if ans < R - L: -        ans = R - L +s = list(eval(input())) +L = [0] +R = [] +for i, (a, b) in enumerate(zip(s, s[1:])): +    if (a, b) == ("0", "1"): +        L.append(i + 1) +    if (a, b) == ("1", "0"): +        R.append(i) +else: +    R.append(n - 1) +ans = R[0] - L[0] + 1 +if s[0] == "0": +    k -= 1 +k = min(k, len(R) - 1) +for l, r in zip(L, R[k:]): +    x = r - l + 1 +    if ans < x: +        ans = x