Buggy python submission (verdict: Runtime Error):
#D
from collections import deque
n,k=map(int,input().split())
s=input()
if n==1:
    print(1)
else:
    a=deque([])
    if s[0]=="1":
        a.append([0])
    for i in range(1,n):
        if s[i-1:i+1]=="01":
            a.append([i])
        elif s[i-1:i+1]=="10":
            a[-1].append(i-1)
    if s[n-1]=="1":
        a[-1].append(n-1)
    if a[0][0]!=0:
        a.appendleft([0,0])
    if a[-1][1]!=n-1:
        a.append([n-1,n-1])
    if len(a)-1<=k:
        print(n)
    else:
        t=0
        for i in range(len(a)-k):
            t=max(t,a[i+k][1]-a[i][0]+1)
        print(t)

Fixed submission:
#D
from collections import deque
n,k=map(int,input().split())
s=input()
if n==1:
    print(1)
elif "1" not in s:
  	print(len(s))
else:
    a=deque([])
    if s[0]=="1":
        a.append([0])
    for i in range(1,n):
        if s[i-1:i+1]=="01":
            a.append([i])
        elif s[i-1:i+1]=="10":
            a[-1].append(i-1)
    if s[n-1]=="1":
        a[-1].append(n-1)
    if a[0][0]!=0:
        a.appendleft([0,0])
    if a[-1][1]!=n-1:
        a.append([n-1,n-1])
    if len(a)-1<=k:
        print(n)
    else:
        t=0
        for i in range(len(a)-k):
            t=max(t,a[i+k][1]-a[i][0]+1)
        print(t)

Buggy python submission (verdict: Runtime Error):
from collections import deque
n,k=map(int,input().split())
s=input()
if n==1:
    print(1)
else:
	a=deque([])
	if s[0]=="1":
    	a.append([0])
	for i in range(1,n):
    	if s[i-1:i+1]=="01":
        	a.append([i])
    	elif s[i-1:i+1]=="10":
        	a[-1].append(i-1)
	if s[n-1]=="1":
    	a[-1].append(n-1)
	if a[0][0]!=0:
    	a.appendleft([0,0])
	if a[-1][1]!=n-1:
    	a.append([n-1,n-1])
        
	if len(a)-1<=k:
    	print(n)
	else:
    	t=0
    	for i in range(len(a)-k):
        	t=max(t,a[i+k][1]-a[i][0]+1)
    	print(t)

Fixed submission:
#D
from collections import deque
n,k=map(int,input().split())
s=input()
if n==1:
    print(1)
elif "1" not in s:
  	print(len(s))
else:
    a=deque([])
    if s[0]=="1":
        a.append([0])
    for i in range(1,n):
        if s[i-1:i+1]=="01":
            a.append([i])
        elif s[i-1:i+1]=="10":
            a[-1].append(i-1)
    if s[n-1]=="1":
        a[-1].append(n-1)
    if a[0][0]!=0:
        a.appendleft([0,0])
    if a[-1][1]!=n-1:
        a.append([n-1,n-1])
    if len(a)-1<=k:
        print(n)
    else:
        t=0
        for i in range(len(a)-k):
            t=max(t,a[i+k][1]-a[i][0]+1)
        print(t)

Buggy python submission (verdict: Runtime Error):
from collections import deque
n,k=map(int,input().split())
s=input()
if n==1:
    print(1)
else:
	a=deque([])
	if s[0]=="1":
    	a.append([0])
	for i in range(1,n):
    	if s[i-1:i+1]=="01":
        	a.append([i])
    	elif s[i-1:i+1]=="10":
        	a[-1].append(i-1)
	if s[n-1]=="1":
    	a[-1].append(n-1)
	if a[0][0]!=0:
    	a.appendleft([0,0])
	if a[-1][1]!=n-1:
    	a.append([n-1,n-1])
	if len(a)-1<=k:
    	print(n)
	else:
    	t=0
    	for i in range(len(a)-k):
        	t=max(t,a[i+k][1]-a[i][0]+1)
    	print(t)

Fixed submission:
#D
from collections import deque
n,k=map(int,input().split())
s=input()
if n==1:
    print(1)
elif "1" not in s:
  	print(len(s))
else:
    a=deque([])
    if s[0]=="1":
        a.append([0])
    for i in range(1,n):
        if s[i-1:i+1]=="01":
            a.append([i])
        elif s[i-1:i+1]=="10":
            a[-1].append(i-1)
    if s[n-1]=="1":
        a[-1].append(n-1)
    if a[0][0]!=0:
        a.appendleft([0,0])
    if a[-1][1]!=n-1:
        a.append([n-1,n-1])
    if len(a)-1<=k:
        print(n)
    else:
        t=0
        for i in range(len(a)-k):
            t=max(t,a[i+k][1]-a[i][0]+1)
        print(t)

Buggy python submission (verdict: Runtime Error):
#D
import sys
from collections import deque
n,k=map(int,input().split())
s=input()
if n==1:
    print(1)
    sys.exit()
a=deque([])
if s[0]=="1":
    a.append([0])
for i in range(1,n):
    if s[i-1:i+1]=="01":
        a.append([i])
    elif s[i-1:i+1]=="10":
        a[-1].append(i-1)
if s[n-1]=="1":
    a[-1].append(n-1)
if a[0][0]!=0:
    a.appendleft([0,0])
if a[-1][1]!=n-1:
    a.append([n-1,n-1])
if len(a)-1<=k:
    print(n)
else:
    t=0
    for i in range(len(a)-k):
        t=max(t,a[i+k][1]-a[i][0]+1)
    print(t)

Fixed submission:
#D
from collections import deque
n,k=map(int,input().split())
s=input()
if n==1:
    print(1)
elif "1" not in s:
  	print(len(s))
else:
    a=deque([])
    if s[0]=="1":
        a.append([0])
    for i in range(1,n):
        if s[i-1:i+1]=="01":
            a.append([i])
        elif s[i-1:i+1]=="10":
            a[-1].append(i-1)
    if s[n-1]=="1":
        a[-1].append(n-1)
    if a[0][0]!=0:
        a.appendleft([0,0])
    if a[-1][1]!=n-1:
        a.append([n-1,n-1])
    if len(a)-1<=k:
        print(n)
    else:
        t=0
        for i in range(len(a)-k):
            t=max(t,a[i+k][1]-a[i][0]+1)
        print(t)

Buggy python submission (verdict: Runtime Error):
#D
import sys
from collections import deque
n,k=map(int,input().split())
s=input()
if n==1:
    print(1)
    sys.exit()
a=deque([])
if s[0]=="1":
    a.append([0])
for i in range(1,n):
    if s[i-1:i+1]=="01":
        a.append([i])
    elif s[i-1:i+1]=="10":
        a[-1].append(i-1)
if s[n-1]=="1":
    a[-1].append(n-1)

if a[0][0]!="0":
    a.appendleft([0,0])
if a[-1][1]!="n-1":
    a.append([n-1,n-1])

if len(a)-1<=k:
    print(n)
else:
    t=0
    for i in range(len(a)-k):
        t=max(t,a[i+k][1]-a[i][0]+1)
    print(t)

Fixed submission:
#D
from collections import deque
n,k=map(int,input().split())
s=input()
if n==1:
    print(1)
elif "1" not in s:
  	print(len(s))
else:
    a=deque([])
    if s[0]=="1":
        a.append([0])
    for i in range(1,n):
        if s[i-1:i+1]=="01":
            a.append([i])
        elif s[i-1:i+1]=="10":
            a[-1].append(i-1)
    if s[n-1]=="1":
        a[-1].append(n-1)
    if a[0][0]!=0:
        a.appendleft([0,0])
    if a[-1][1]!=n-1:
        a.append([n-1,n-1])
    if len(a)-1<=k:
        print(n)
    else:
        t=0
        for i in range(len(a)-k):
            t=max(t,a[i+k][1]-a[i][0]+1)
        print(t)

Buggy python submission (verdict: Runtime Error):
#D
from collections import deque
n,k=map(int,input().split())
s=input()

a=deque([])
if s[0]=="1":
    a.append([0])
for i in range(1,n):
    if s[i-1:i+1]=="01":
        a.append([i])
    elif s[i-1:i+1]=="10":
        a[-1].append(i-1)
if s[n-1]=="1":
    a[-1].append(n-1)

if a[0][0]!="0":
    a.appendleft([0,0])
if a[-1][1]!="n-1":
    a.append([n-1,n-1])

if len(a)-1<=k:
    print(n)
else:
    t=0
    for i in range(len(a)-k):
        t=max(t,a[i+k][1]-a[i][0]+1)
    print(t)

Fixed submission:
#D
from collections import deque
n,k=map(int,input().split())
s=input()
if n==1:
    print(1)
elif "1" not in s:
  	print(len(s))
else:
    a=deque([])
    if s[0]=="1":
        a.append([0])
    for i in range(1,n):
        if s[i-1:i+1]=="01":
            a.append([i])
        elif s[i-1:i+1]=="10":
            a[-1].append(i-1)
    if s[n-1]=="1":
        a[-1].append(n-1)
    if a[0][0]!=0:
        a.appendleft([0,0])
    if a[-1][1]!=n-1:
        a.append([n-1,n-1])
    if len(a)-1<=k:
        print(n)
    else:
        t=0
        for i in range(len(a)-k):
            t=max(t,a[i+k][1]-a[i][0]+1)
        print(t)

Buggy python submission (verdict: Runtime Error):
#D
from collections import deque
n,k=map(int,input().split())
s=input()

a=deque([])
if s[0]=="1":
    a.append([0])
for i in range(1,n):
    if s[i-1:i+1]=="01":
        a.append([i])
    elif s[i-1:i+1]=="10":
        a[-1].append(i-1)
if s[n-1]=="1":
    a[-1].append(n-1)

if a[0][0]!="0":
    a.appendleft([0,0])
if a[-1][1]!="n-1":
    a.append([n-1,n-1])

if len(a)-1<=k:
    print(n)
else:
    t=[]
    for i in range(len(a)-1-k):
        t.append(a[i+k][1]-a[i][0])
    print(max(t)+1)

Fixed submission:
#D
from collections import deque
n,k=map(int,input().split())
s=input()
if n==1:
    print(1)
elif "1" not in s:
  	print(len(s))
else:
    a=deque([])
    if s[0]=="1":
        a.append([0])
    for i in range(1,n):
        if s[i-1:i+1]=="01":
            a.append([i])
        elif s[i-1:i+1]=="10":
            a[-1].append(i-1)
    if s[n-1]=="1":
        a[-1].append(n-1)
    if a[0][0]!=0:
        a.appendleft([0,0])
    if a[-1][1]!=n-1:
        a.append([n-1,n-1])
    if len(a)-1<=k:
        print(n)
    else:
        t=0
        for i in range(len(a)-k):
            t=max(t,a[i+k][1]-a[i][0]+1)
        print(t)