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



s=eval(input())

s = list(map(int,s))



memo = [0]



for i in range(1,n):

    if s[i-1] != s[i]:

        memo.append(i)



ans = 0

for i in range(len(memo)):

    start = memo[i]

    if (s[start] == 1):

        end = i + 2*k +1

    else:

        end = i + 2*k

    if end < len(memo):

        end = memo[end]

    else:

        end = len(s)

    ans = max(ans, end-start)

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



s=list(eval(input()))



memo = [0]



for i in range(1,n):

  if s[i] != s[i-1]:

    memo.append(i)



ans = 0



kyoukai_math = len(memo)



for i in range(kyoukai_math):

  if s[memo[i]] == '1':

    hasi = i+k*2+1

  else:

    hasi = i+k*2

    

  if hasi < kyoukai_math:

    ans = max(ans,memo[hasi]-memo[i])

  else:

    ans = max(ans,n-memo[i])

print(ans)
n, k = list(map(int, input().split()))
s = eval(input())
s = list(map(int, s))
memo = [0]
for i in range(1, n):
    if s[i - 1] != s[i]:
        memo.append(i)
ans = 0
for i in range(len(memo)):
    start = memo[i]
    if s[start] == 1:
        end = i + 2 * k + 1
    else:
        end = i + 2 * k
    if end < len(memo):
        end = memo[end]
    else:
        end = len(s)
    ans = max(ans, end - start)
print(ans)

n, k = list(map(int, input().split()))
s = list(eval(input()))
memo = [0]
for i in range(1, n):
    if s[i] != s[i - 1]:
        memo.append(i)
ans = 0
kyoukai_math = len(memo)
for i in range(kyoukai_math):
    if s[memo[i]] == "1":
        hasi = i + k * 2 + 1
    else:
        hasi = i + k * 2
    if hasi < kyoukai_math:
        ans = max(ans, memo[hasi] - memo[i])
    else:
        ans = max(ans, n - memo[i])
print(ans)

-s = eval(input()) -s = list(map(int, s)) +s = list(eval(input())) -    if s[i - 1] != s[i]: +    if s[i] != s[i - 1]: -for i in range(len(memo)): -    start = memo[i] -    if s[start] == 1: -        end = i + 2 * k + 1 +kyoukai_math = len(memo) +for i in range(kyoukai_math): +    if s[memo[i]] == "1": +        hasi = i + k * 2 + 1 -        end = i + 2 * k -    if end < len(memo): -        end = memo[end] +        hasi = i + k * 2 +    if hasi < kyoukai_math: +        ans = max(ans, memo[hasi] - memo[i]) -        end = len(s) -    ans = max(ans, end - start) +        ans = max(ans, n - memo[i])