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

S = eval(input())



A = []

if S[0] == '0':

  A.append(0)



i = 0

while i < len(S):

  j = i

  while j < len(S) and S[i] == S[j]:

    j += 1

  A.append(j - i)

  i = j



ans = 0

tot = 0

r = 0



for l in range(len(A)):

  while r < len(A) and r - l < 2 * K + 1:

    tot += A[r]

    r += 1

  if l % 2 == 0:

    ans = max(ans, tot)

  if l == r:

    r += 1

  else:

    tot -= A[l]



print(ans)

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

S = eval(input())

A = []

if S[0] == '0':

  A.append(0)

i = 0

while i < len(S):

  j = i

  while j < len(S) and S[i] == S[j]:

    j += 1

  A.append(j - i)

  i = j

ans = 0

tot = 0

r = 0

for l in range(len(A)):

  while r < len(A) and r - l < 2 * K + 1:

    tot += A[r]

    r += 1

  if l % 2 == 0:

    ans = max(ans, tot)

  if r == l:

    r += 1

  else:

    tot -= A[l]

print(ans)

N, K = list(map(int, input().split()))
S = eval(input())
A = []
if S[0] == "0":
    A.append(0)
i = 0
while i < len(S):
    j = i
    while j < len(S) and S[i] == S[j]:
        j += 1
    A.append(j - i)
    i = j
ans = 0
tot = 0
r = 0
for l in range(len(A)):
    while r < len(A) and r - l < 2 * K + 1:
        tot += A[r]
        r += 1
    if l % 2 == 0:
        ans = max(ans, tot)
    if l == r:
        r += 1
    else:
        tot -= A[l]
print(ans)

N, K = list(map(int, input().split()))
S = eval(input())
A = []
if S[0] == "0":
    A.append(0)
i = 0
while i < len(S):
    j = i
    while j < len(S) and S[i] == S[j]:
        j += 1
    A.append(j - i)
    i = j
ans = 0
tot = 0
r = 0
for l in range(len(A)):
    while r < len(A) and r - l < 2 * K + 1:
        tot += A[r]
        r += 1
    if l % 2 == 0:
        ans = max(ans, tot)
    if r == l:
        r += 1
    else:
        tot -= A[l]
print(ans)

-    if l == r: +    if r == l: