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

s = eval(input())

tmp = s[0]

cnt = 1

ans = 0

ss = []

res = [0]

sum = 0

if s[0] == '0':

    ss.append(0)



for i in range(1,n):

    if s[i] == tmp:

        cnt += 1

    else:

        tmp = s[i]

        ss.append(cnt)

        cnt = 1

ss.append(cnt)

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

    ss.append(0)

ll = len(ss)

for i in range(ll):

    sum += ss[i]

    res.append(sum)



if ll//2 <= k:

    print(n)

else:

    for i in range(ll-k*2)[::2]:

        ans = max(ans, res[i+k*2+1]-res[i])

    print(ans)

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

s = eval(input())

tmp = s[0]

cnt = 1

ss = []

if s[0] == '0':

    ss.append(0)



for i in range(1,n):

    if s[i] == tmp:

        cnt += 1

    else:

        tmp = s[i]

        ss.append(cnt)

        cnt = 1

ss.append(cnt)

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

    ss.append(0)

ll = len(ss)



l = 0

r = k*2

tt = sum(ss[l:r+1])

ans = tt

while True:

    l += 2

    r += 2

    if r > ll:

        break

    tt += ss[r] + ss[r-1]

    tt -= ss[l-1] + ss[l-2]

    ans = max(ans, tt)

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

n, k = list(map(int, input().split()))
s = eval(input())
tmp = s[0]
cnt = 1
ss = []
if s[0] == "0":
    ss.append(0)
for i in range(1, n):
    if s[i] == tmp:
        cnt += 1
    else:
        tmp = s[i]
        ss.append(cnt)
        cnt = 1
ss.append(cnt)
if s[-1] == "0":
    ss.append(0)
ll = len(ss)
l = 0
r = k * 2
tt = sum(ss[l : r + 1])
ans = tt
while True:
    l += 2
    r += 2
    if r > ll:
        break
    tt += ss[r] + ss[r - 1]
    tt -= ss[l - 1] + ss[l - 2]
    ans = max(ans, tt)
print(ans)

-ans = 0 -res = [0] -sum = 0 -for i in range(ll): -    sum += ss[i] -    res.append(sum) -if ll // 2 <= k: -    print(n) -else: -    for i in range(ll - k * 2)[::2]: -        ans = max(ans, res[i + k * 2 + 1] - res[i]) -    print(ans) +l = 0 +r = k * 2 +tt = sum(ss[l : r + 1]) +ans = tt +while True: +    l += 2 +    r += 2 +    if r > ll: +        break +    tt += ss[r] + ss[r - 1] +    tt -= ss[l - 1] + ss[l - 2] +    ans = max(ans, tt) +print(ans)