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

*s,=eval(input())

g=[]

t=1

for i in range(1,n):

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

 else:g.append(t);t=1

g.append(t)

for i in range(1,len(g)):g[i]+=g[i-1]

g=[0]+g+[g[-1]]

print((max(g[i]-g[max(0,i-2*k-1)]for i in range(s[0]=='1',len(g),2))))
t,s=open(0)

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

l=2*k+1

x=[0]*(2+int(s[0]))+[i+1for i in range(n-1)if s[i]!=s[i+1]]+[n]*l

print((max(x[i+l]-x[i]for i in range(0,len(x)-l,2))))
n, k = list(map(int, input().split()))
(*s,) = eval(input())
g = []
t = 1
for i in range(1, n):
    if s[i] == s[i - 1]:
        t += 1
    else:
        g.append(t)
        t = 1
g.append(t)
for i in range(1, len(g)):
    g[i] += g[i - 1]
g = [0] + g + [g[-1]]
print((max(g[i] - g[max(0, i - 2 * k - 1)] for i in range(s[0] == "1", len(g), 2))))

t, s = open(0)
n, k = list(map(int, t.split()))
l = 2 * k + 1
x = [0] * (2 + int(s[0])) + [i + 1 for i in range(n - 1) if s[i] != s[i + 1]] + [n] * l
print((max(x[i + l] - x[i] for i in range(0, len(x) - l, 2))))

-n, k = list(map(int, input().split())) -(*s,) = eval(input()) -g = [] -t = 1 -for i in range(1, n): -    if s[i] == s[i - 1]: -        t += 1 -    else: -        g.append(t) -        t = 1 -g.append(t) -for i in range(1, len(g)): -    g[i] += g[i - 1] -g = [0] + g + [g[-1]] -print((max(g[i] - g[max(0, i - 2 * k - 1)] for i in range(s[0] == "1", len(g), 2)))) +t, s = open(0) +n, k = list(map(int, t.split())) +l = 2 * k + 1 +x = [0] * (2 + int(s[0])) + [i + 1 for i in range(n - 1) if s[i] != s[i + 1]] + [n] * l +print((max(x[i + l] - x[i] for i in range(0, len(x) - l, 2))))