from itertools import groupby

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

s = eval(input())



t = []

if s[0] == "0":

    t.append(("1", 0))

for c, v in groupby(s):

    t.append((c, sum(1 for _ in v)))



if s[-1] == "0":

    t.append(("1", 0))



S = [t[0][1]]

rm = [0]

m = len(t)

for i in range(m//2):

    tmp = S[-1]

    S.append(tmp+t[2*i+1][1]+t[2*i+2][1])

    rm.append(tmp+t[2*i+1][1])



ans = []

for i in range(m//2+1):

    if i - k < 0:

        ans.append(S[i])

    else:

        ans.append(S[i]-rm[i-k])

print((max(ans)))

from itertools import groupby

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

s = eval(input())



t = []

if s[0] == "0":

    t.append(("1", 0))



cnt = 1

for i in range(n):

    if i != n-1:

        if s[i] == s[i+1]:

            cnt += 1

        else:

            t.append((s[i], cnt))

            cnt = 1

    if i == n-1:

        t.append((s[i], cnt))



if s[-1] == "0":

    t.append(("1", 0))



S = [t[0][1]]

rm = [0]

m = len(t)

for i in range(m//2):

    tmp = S[-1]

    S.append(tmp+t[2*i+1][1]+t[2*i+2][1])

    rm.append(tmp+t[2*i+1][1])



ans = []

for i in range(m//2+1):

    if i - k < 0:

        ans.append(S[i])

    else:

        ans.append(S[i]-rm[i-k])

print((max(ans)))

from itertools import groupby

n, k = list(map(int, input().split()))
s = eval(input())
t = []
if s[0] == "0":
    t.append(("1", 0))
for c, v in groupby(s):
    t.append((c, sum(1 for _ in v)))
if s[-1] == "0":
    t.append(("1", 0))
S = [t[0][1]]
rm = [0]
m = len(t)
for i in range(m // 2):
    tmp = S[-1]
    S.append(tmp + t[2 * i + 1][1] + t[2 * i + 2][1])
    rm.append(tmp + t[2 * i + 1][1])
ans = []
for i in range(m // 2 + 1):
    if i - k < 0:
        ans.append(S[i])
    else:
        ans.append(S[i] - rm[i - k])
print((max(ans)))

from itertools import groupby

n, k = list(map(int, input().split()))
s = eval(input())
t = []
if s[0] == "0":
    t.append(("1", 0))
cnt = 1
for i in range(n):
    if i != n - 1:
        if s[i] == s[i + 1]:
            cnt += 1
        else:
            t.append((s[i], cnt))
            cnt = 1
    if i == n - 1:
        t.append((s[i], cnt))
if s[-1] == "0":
    t.append(("1", 0))
S = [t[0][1]]
rm = [0]
m = len(t)
for i in range(m // 2):
    tmp = S[-1]
    S.append(tmp + t[2 * i + 1][1] + t[2 * i + 2][1])
    rm.append(tmp + t[2 * i + 1][1])
ans = []
for i in range(m // 2 + 1):
    if i - k < 0:
        ans.append(S[i])
    else:
        ans.append(S[i] - rm[i - k])
print((max(ans)))

-for c, v in groupby(s): -    t.append((c, sum(1 for _ in v))) +cnt = 1 +for i in range(n): +    if i != n - 1: +        if s[i] == s[i + 1]: +            cnt += 1 +        else: +            t.append((s[i], cnt)) +            cnt = 1 +    if i == n - 1: +        t.append((s[i], cnt))