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

S = eval(input())

if S[0] == '0':

  divide = []

else:

  divide = [0]

tmp = 1

for i in range(1,N):

  if S[i] == S[i-1]:

    tmp += 1

  else:

    divide += [tmp]

    tmp = 1

divide += [tmp]

le = len(divide)

zero = [0]*2*le + divide + [0]*2*le

su = [0]

for i in range(0,5*le):

  su += [su[-1]+zero[i]]

del su[0]

lle = len(su)

mxm = 0

for k in range(K,lle):

  if 2*k+1 >= lle:

    break

  cd = su[2*k+1] - su[2*k-2*K]

  if cd > mxm:

    mxm = cd

xmx = max(divide)

print((max(mxm,xmx)))
#20:03

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

s = eval(input())

if s[0] == '1':

  can01 = [0]

  can10 = []

else:

  can01 = [0]

  can10 = [0]

for i in range(1,n):

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

    can01.append(i)

  elif s[i-1] == '1' and s[i] == '0':

    can10.append(i)

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

  can10.append(n)

else:

  can10.append(n)

  can01.append(n)

#print(can01,can10)

can01 = [0] * k + can01

can10 = can10 + [n] * k

#print(can01,can10)

ans = []

for i in range(len(can10)):

  ans.append(can10[i] - can01[i])

print((max(ans)))
N, K = list(map(int, input().split()))
S = eval(input())
if S[0] == "0":
    divide = []
else:
    divide = [0]
tmp = 1
for i in range(1, N):
    if S[i] == S[i - 1]:
        tmp += 1
    else:
        divide += [tmp]
        tmp = 1
divide += [tmp]
le = len(divide)
zero = [0] * 2 * le + divide + [0] * 2 * le
su = [0]
for i in range(0, 5 * le):
    su += [su[-1] + zero[i]]
del su[0]
lle = len(su)
mxm = 0
for k in range(K, lle):
    if 2 * k + 1 >= lle:
        break
    cd = su[2 * k + 1] - su[2 * k - 2 * K]
    if cd > mxm:
        mxm = cd
xmx = max(divide)
print((max(mxm, xmx)))

# 20:03
n, k = list(map(int, input().split()))
s = eval(input())
if s[0] == "1":
    can01 = [0]
    can10 = []
else:
    can01 = [0]
    can10 = [0]
for i in range(1, n):
    if s[i - 1] == "0" and s[i] == "1":
        can01.append(i)
    elif s[i - 1] == "1" and s[i] == "0":
        can10.append(i)
if s[n - 1] == "1":
    can10.append(n)
else:
    can10.append(n)
    can01.append(n)
# print(can01,can10)
can01 = [0] * k + can01
can10 = can10 + [n] * k
# print(can01,can10)
ans = []
for i in range(len(can10)):
    ans.append(can10[i] - can01[i])
print((max(ans)))

-N, K = list(map(int, input().split())) -S = eval(input()) -if S[0] == "0": -    divide = [] +# 20:03 +n, k = list(map(int, input().split())) +s = eval(input()) +if s[0] == "1": +    can01 = [0] +    can10 = [] -    divide = [0] -tmp = 1 -for i in range(1, N): -    if S[i] == S[i - 1]: -        tmp += 1 -    else: -        divide += [tmp] -        tmp = 1 -divide += [tmp] -le = len(divide) -zero = [0] * 2 * le + divide + [0] * 2 * le -su = [0] -for i in range(0, 5 * le): -    su += [su[-1] + zero[i]] -del su[0] -lle = len(su) -mxm = 0 -for k in range(K, lle): -    if 2 * k + 1 >= lle: -        break -    cd = su[2 * k + 1] - su[2 * k - 2 * K] -    if cd > mxm: -        mxm = cd -xmx = max(divide) -print((max(mxm, xmx))) +    can01 = [0] +    can10 = [0] +for i in range(1, n): +    if s[i - 1] == "0" and s[i] == "1": +        can01.append(i) +    elif s[i - 1] == "1" and s[i] == "0": +        can10.append(i) +if s[n - 1] == "1": +    can10.append(n) +else: +    can10.append(n) +    can01.append(n) +# print(can01,can10) +can01 = [0] * k + can01 +can10 = can10 + [n] * k +# print(can01,can10) +ans = [] +for i in range(len(can10)): +    ans.append(can10[i] - can01[i]) +print((max(ans)))