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

S = eval(input())

L = [0]

ans = 0

res = '1'

i = 0

for s in S:

    if s != res:

        L.append(i)

        i += 1

    else:

        i += 1

    res = s

L.append(i)

L.append(i)

if len(L)<=2*K+1:

    ans = N

for i in range(0,len(L)-K*2-1,2):

    ans = max(ans,L[i+K*2+1]-L[i])

print(ans)
def func():

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

    S = eval(input())

    L = []

    L.append(0) if S[0] == '0' else 0

    num = '2'

    for i in range(N):

        if num != S[i]:

            L.append(i)

            num = S[i]

    L.append(N)

    L.append(N)

    ans = 0

    for i in range(0,len(L)-K*2-1,2):

        ans = max(ans,L[i+K*2+1]-L[i])

    return N if N < 3 or K >= len(L)//2 else ans

print((func()))
N, K = list(map(int, input().split()))
S = eval(input())
L = [0]
ans = 0
res = "1"
i = 0
for s in S:
    if s != res:
        L.append(i)
        i += 1
    else:
        i += 1
    res = s
L.append(i)
L.append(i)
if len(L) <= 2 * K + 1:
    ans = N
for i in range(0, len(L) - K * 2 - 1, 2):
    ans = max(ans, L[i + K * 2 + 1] - L[i])
print(ans)

def func():
    N, K = list(map(int, input().split()))
    S = eval(input())
    L = []
    L.append(0) if S[0] == "0" else 0
    num = "2"
    for i in range(N):
        if num != S[i]:
            L.append(i)
            num = S[i]
    L.append(N)
    L.append(N)
    ans = 0
    for i in range(0, len(L) - K * 2 - 1, 2):
        ans = max(ans, L[i + K * 2 + 1] - L[i])
    return N if N < 3 or K >= len(L) // 2 else ans


print((func()))

-N, K = list(map(int, input().split())) -S = eval(input()) -L = [0] -ans = 0 -res = "1" -i = 0 -for s in S: -    if s != res: -        L.append(i) -        i += 1 -    else: -        i += 1 -    res = s -L.append(i) -L.append(i) -if len(L) <= 2 * K + 1: -    ans = N -for i in range(0, len(L) - K * 2 - 1, 2): -    ans = max(ans, L[i + K * 2 + 1] - L[i]) -print(ans) +def func(): +    N, K = list(map(int, input().split())) +    S = eval(input()) +    L = [] +    L.append(0) if S[0] == "0" else 0 +    num = "2" +    for i in range(N): +        if num != S[i]: +            L.append(i) +            num = S[i] +    L.append(N) +    L.append(N) +    ans = 0 +    for i in range(0, len(L) - K * 2 - 1, 2): +        ans = max(ans, L[i + K * 2 + 1] - L[i]) +    return N if N < 3 or K >= len(L) // 2 else ans + + +print((func()))