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

s=eval(input())

t=1

l=[0]

for i in s:

  i=int(i)

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

  else: l+=[1]; t=i

if t<1: l+=[0]

s=[0]

for i in l: s+=[s[-1]+i]

a=0

for i in range(0,len(l),2):

  if i<2*k: a=max(a,s[i+1])

  else: a=max(a,s[i+1]-s[i-k*2])

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

s=[int(i) for i in eval(input())]

l1,l0=[],[]

b,c=1,0

for i in s:

  if b==i: c+=1

  else:

    if b: l1+=[c]

    else: l0+=[c]

    c=1

  b=i

if b:

  l1+=[c]

  l0+=[0]

else:

  l0+=[c]

S=[0]

for i,j in zip(l1,l0):

  S+=[S[-1]+i+j]

l1+=[0]

l0+=[0]

m=len(S)

if m<=k: print(n)

else:

  a=0

  for i in range(k,m):

    a=max(a,S[i]-S[i-k]+l1[i])

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

n, k = list(map(int, input().split()))
s = [int(i) for i in eval(input())]
l1, l0 = [], []
b, c = 1, 0
for i in s:
    if b == i:
        c += 1
    else:
        if b:
            l1 += [c]
        else:
            l0 += [c]
        c = 1
    b = i
if b:
    l1 += [c]
    l0 += [0]
else:
    l0 += [c]
S = [0]
for i, j in zip(l1, l0):
    S += [S[-1] + i + j]
l1 += [0]
l0 += [0]
m = len(S)
if m <= k:
    print(n)
else:
    a = 0
    for i in range(k, m):
        a = max(a, S[i] - S[i - k] + l1[i])
    print(a)

-s = eval(input()) -t = 1 -l = [0] +s = [int(i) for i in eval(input())] +l1, l0 = [], [] +b, c = 1, 0 -    i = int(i) -    if i == t: -        l[-1] += 1 +    if b == i: +        c += 1 -        l += [1] -        t = i -if t < 1: -    l += [0] -s = [0] -for i in l: -    s += [s[-1] + i] -a = 0 -for i in range(0, len(l), 2): -    if i < 2 * k: -        a = max(a, s[i + 1]) -    else: -        a = max(a, s[i + 1] - s[i - k * 2]) -print(a) +        if b: +            l1 += [c] +        else: +            l0 += [c] +        c = 1 +    b = i +if b: +    l1 += [c] +    l0 += [0] +else: +    l0 += [c] +S = [0] +for i, j in zip(l1, l0): +    S += [S[-1] + i + j] +l1 += [0] +l0 += [0] +m = len(S) +if m <= k: +    print(n) +else: +    a = 0 +    for i in range(k, m): +        a = max(a, S[i] - S[i - k] + l1[i]) +    print(a)