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

S=list(eval(input()))

j=0

ans=0

cnt=0

for i in range(N):

  if S[i]=="0":

    if i==0 or S[i-1]=="1":

      cnt+=1

  if cnt>K:

    while S[j]=="1":

      j+=1

    while S[j]=="0":

      j+=1

    cnt-=1

  ans=max(ans,i-j+1)



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

S=eval(input())

#Aは0の左端、Bは0の右端

A=[]

B=[]

for i in range(N-1):

  if S[i]=='0'and S[i+1]=='1':

    B.append(i)

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

  B.append(N-1)

if S[0]=='0':

  A.append(0)

for i in range(N-1):

  if S[i]=='1'and S[i+1]=='0':

    A.append(i+1)



if len(A)<=K:

  print(N)

else:

  y=A[K]

  z=N-B[-1*(K+1)]-1

  l=0

  ans=0

  for i in range(len(A)-K-1):

    l=A[i+K+1]-B[i]-1

    ans=max(l,ans)

  print((max(ans,y,z)))
N, K = list(map(int, input().split()))
S = list(eval(input()))
j = 0
ans = 0
cnt = 0
for i in range(N):
    if S[i] == "0":
        if i == 0 or S[i - 1] == "1":
            cnt += 1
    if cnt > K:
        while S[j] == "1":
            j += 1
        while S[j] == "0":
            j += 1
        cnt -= 1
    ans = max(ans, i - j + 1)
print(ans)

N, K = list(map(int, input().split()))
S = eval(input())
# Aは0の左端、Bは0の右端
A = []
B = []
for i in range(N - 1):
    if S[i] == "0" and S[i + 1] == "1":
        B.append(i)
if S[-1] == "0":
    B.append(N - 1)
if S[0] == "0":
    A.append(0)
for i in range(N - 1):
    if S[i] == "1" and S[i + 1] == "0":
        A.append(i + 1)
if len(A) <= K:
    print(N)
else:
    y = A[K]
    z = N - B[-1 * (K + 1)] - 1
    l = 0
    ans = 0
    for i in range(len(A) - K - 1):
        l = A[i + K + 1] - B[i] - 1
        ans = max(l, ans)
    print((max(ans, y, z)))

-S = list(eval(input())) -j = 0 -ans = 0 -cnt = 0 -for i in range(N): -    if S[i] == "0": -        if i == 0 or S[i - 1] == "1": -            cnt += 1 -    if cnt > K: -        while S[j] == "1": -            j += 1 -        while S[j] == "0": -            j += 1 -        cnt -= 1 -    ans = max(ans, i - j + 1) -print(ans) +S = eval(input()) +# Aは0の左端、Bは0の右端 +A = [] +B = [] +for i in range(N - 1): +    if S[i] == "0" and S[i + 1] == "1": +        B.append(i) +if S[-1] == "0": +    B.append(N - 1) +if S[0] == "0": +    A.append(0) +for i in range(N - 1): +    if S[i] == "1" and S[i + 1] == "0": +        A.append(i + 1) +if len(A) <= K: +    print(N) +else: +    y = A[K] +    z = N - B[-1 * (K + 1)] - 1 +    l = 0 +    ans = 0 +    for i in range(len(A) - K - 1): +        l = A[i + K + 1] - B[i] - 1 +        ans = max(l, ans) +    print((max(ans, y, z)))