import sys



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

S = eval(input())





def nexti(n):

    while S[n] == '1':

        n += 1

    while S[n] == '0':

        n += 1

    return n





def nextj(n):

    while S[n] == '0':

        n += 1

        if n == N:

            return N

    while S[n] == '1':

        n += 1

        if n == N:

            return N

    return n





i = 0

j = 0

while S[j] == '1':

    j += 1

    if j == N:

        print(N)

        sys.exit(0)

for _ in range(K):

    j = nextj(j)

    if j == N:

        print(N)

        sys.exit(0)



ans = j - i

while True:

    i = nexti(i)

    j = nextj(j)

    ans = max(ans, j - i)

    if j == N:

        break



print(ans)
from collections import deque





def nextj(n):

    while S[n] == '0':

        n += 1

        if n == N:

            return N

    q.appendleft(n)

    while S[n] == '1':

        n += 1

        if n == N:

            return N

    return n





def init(n):

    while S[n] == '1':

        n += 1

        if n == N:

            return N

    return n





def calc():

    q.appendleft(0)

    ans = 0

    j = init(0)

    if j == N:

        return N

    for _ in range(K - 1):

        j = nextj(j)

        if j == N:

            return N

    while True:

        j = nextj(j)

        ans = max(ans, j - q.pop())

        if j == N:

            return ans





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

S = eval(input())

q = deque()

print((calc()))

import sys

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


def nexti(n):
    while S[n] == "1":
        n += 1
    while S[n] == "0":
        n += 1
    return n


def nextj(n):
    while S[n] == "0":
        n += 1
        if n == N:
            return N
    while S[n] == "1":
        n += 1
        if n == N:
            return N
    return n


i = 0
j = 0
while S[j] == "1":
    j += 1
    if j == N:
        print(N)
        sys.exit(0)
for _ in range(K):
    j = nextj(j)
    if j == N:
        print(N)
        sys.exit(0)
ans = j - i
while True:
    i = nexti(i)
    j = nextj(j)
    ans = max(ans, j - i)
    if j == N:
        break
print(ans)

from collections import deque


def nextj(n):
    while S[n] == "0":
        n += 1
        if n == N:
            return N
    q.appendleft(n)
    while S[n] == "1":
        n += 1
        if n == N:
            return N
    return n


def init(n):
    while S[n] == "1":
        n += 1
        if n == N:
            return N
    return n


def calc():
    q.appendleft(0)
    ans = 0
    j = init(0)
    if j == N:
        return N
    for _ in range(K - 1):
        j = nextj(j)
        if j == N:
            return N
    while True:
        j = nextj(j)
        ans = max(ans, j - q.pop())
        if j == N:
            return ans


N, K = list(map(int, input().split()))
S = eval(input())
q = deque()
print((calc()))

-import sys - -N, K = list(map(int, input().split())) -S = eval(input()) - - -def nexti(n): -    while S[n] == "1": -        n += 1 -    while S[n] == "0": -        n += 1 -    return n +from collections import deque +    q.appendleft(n) -i = 0 -j = 0 -while S[j] == "1": -    j += 1 +def init(n): +    while S[n] == "1": +        n += 1 +        if n == N: +            return N +    return n + + +def calc(): +    q.appendleft(0) +    ans = 0 +    j = init(0) -        print(N) -        sys.exit(0) -for _ in range(K): -    j = nextj(j) -    if j == N: -        print(N) -        sys.exit(0) -ans = j - i -while True: -    i = nexti(i) -    j = nextj(j) -    ans = max(ans, j - i) -    if j == N: -        break -print(ans) +        return N +    for _ in range(K - 1): +        j = nextj(j) +        if j == N: +            return N +    while True: +        j = nextj(j) +        ans = max(ans, j - q.pop()) +        if j == N: +            return ans + + +N, K = list(map(int, input().split())) +S = eval(input()) +q = deque() +print((calc()))