from itertools import groupby

from numpy import cumsum





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

S = input().strip()



if len(set(S)) == 1:

    print(N)

    exit()



G = []

if S[0] == '0':

    G.append(0)

for k, v in groupby(S):

    G.append(len(list(v)))

G.append(0)



cum = [0]

cum.extend(list(cumsum(G)))

cum.append(0)



ans = 0

gc = len(G)

w = min(gc, 3+(K-1)*2)

for i in range(0, gc-w+2, 2):

    ans = max(ans, cum[i+w]-cum[i])

print(ans)

from itertools import groupby

from numpy import cumsum





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

S = input().strip()



if len(set(S)) == 1:

    print(N)

    exit()



G = []

for k, v in groupby(S):

    G.append(len(list(v)))

if S[0] == '0':

    G.insert(0, 0)

if S[-1] == '0':

    G.append(0)



cum = [0]

cum.extend(list(cumsum(G)))

cum.append(0)



ans = 0

gc = len(G)

w = min(gc, 3+(K-1)*2)

for i in range(0, gc-w+2, 2):

    ans = max(ans, cum[i+w]-cum[i])

print(ans)

from itertools import groupby
from numpy import cumsum

N, K = list(map(int, input().split()))
S = input().strip()
if len(set(S)) == 1:
    print(N)
    exit()
G = []
if S[0] == "0":
    G.append(0)
for k, v in groupby(S):
    G.append(len(list(v)))
G.append(0)
cum = [0]
cum.extend(list(cumsum(G)))
cum.append(0)
ans = 0
gc = len(G)
w = min(gc, 3 + (K - 1) * 2)
for i in range(0, gc - w + 2, 2):
    ans = max(ans, cum[i + w] - cum[i])
print(ans)

from itertools import groupby
from numpy import cumsum

N, K = list(map(int, input().split()))
S = input().strip()
if len(set(S)) == 1:
    print(N)
    exit()
G = []
for k, v in groupby(S):
    G.append(len(list(v)))
if S[0] == "0":
    G.insert(0, 0)
if S[-1] == "0":
    G.append(0)
cum = [0]
cum.extend(list(cumsum(G)))
cum.append(0)
ans = 0
gc = len(G)
w = min(gc, 3 + (K - 1) * 2)
for i in range(0, gc - w + 2, 2):
    ans = max(ans, cum[i + w] - cum[i])
print(ans)

-if S[0] == "0": -    G.append(0) -G.append(0) +if S[0] == "0": +    G.insert(0, 0) +if S[-1] == "0": +    G.append(0)