On each of the following $N$ days (numbered $1$ through $N$), Chef is planning to cook either pizza or broccoli. He wrote down a string $A$ with length $N$, where for each valid $i$, if the character $A_i$ is '1', then he will cook pizza on the $i$-th day, while if $A_i$ is '0', he will cook broccoli on this day.
Chefu, his son, loves pizza but hates broccoli ― just like most kids. He wants to select a substring of $A$ with length $K$ and change each character '0' in this substring to '1'. Afterwards, let's define pizza time as the maximum number of consecutive days where Chef will cook pizza. Find the maximum pizza time Chefu can achieve.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains two space-separated integers $N$ and $K$. 
- The second line contains a string $A$ with length $N$.

-----Output-----
For each test case, print a single line containing one integer ― the maximum pizza time.

-----Constraints-----
- $1 \le T \le 1,000$
- $1 \le K \le N \le 10^5$
- $A$ contains only characters '0' and '1'
- the sum of $N$ over all test cases does not exceed $10^6$

-----Subtasks-----
Subtask #1 (50 points):
- $N \le 10^3$
- the sum of $N$ over all test cases does not exceed $10^4$
Subtask #2 (50 points): original constraints

-----Example Input-----
2
13 2
0101110000101
6 3
100001

-----Example Output-----
5
4

-----Explanation-----
Example case 1: Chefu can choose the substring $A[2, 3]$ = "10", and change the third character of $A$ to '1'. Then, the pizza time is $5$ days: from day $2$ to day $6$.
Example case 2: Chefu can choose the substring $A[2, 4]$ = "000". Then, the pizza time is $4$ days: from day $1$ to day $4$.

Starter code:

Solutions:
for _ in range(int(input())):

 n, k = map(int, input().split())
 l = [*map(int, input())]

 count = [0] * (n + 1)

 for i in range(n - 1, -1, -1):
  if l[i] == 1:
   count[i] = count[i + 1] + 1

 x,y = 0,0
 for i in range(n):
  if l[i] == 1:
   x += 1
  else:
   try:
    y = max(y, x + k + count[i + k])

   except:
    y = max(y, x + min(k, n - i))
   x = 0
  y = max(y,x)
 print(y)

def pizzatime(s,a,k):
 cont1,m_time=0,0
 for i in range(len(s)):
  if(s[i]=='1'):
   cont1+=1
  else:
   try:
    m_time=max(m_time,cont1+k+a[i+k])
   except:
    m_time=max(m_time,cont1+min(k,len(s)-i))
   cont1=0
 m_time=max(m_time,cont1)
 return m_time
   
  
for T in range(int(input())):
 n,k=list(map(int,input().split()))
 s=input()

 all_1=[0]*(n+1)
 check=True
 for ind in range(len(s)-1,-1,-1):
  if(s[ind]=='1'):
   all_1[ind]+=(all_1[ind+1]+1)
   
 print(pizzatime(s,all_1,k))


def pizzatime(s,a,k):
 cont1,m_time=0,0
 for i in range(len(s)):
  if(s[i]=='1'):
   cont1+=1
  else:
   try:
    m_time=max(m_time,cont1+k+a[i+k])
   except:
    m_time=max(m_time,cont1+min(k,len(s)-i))
   cont1=0
 m_time=max(m_time,cont1)
 return m_time
   
  
for T in range(int(input())):
 n,k=list(map(int,input().split()))
 s=input()

 all_1=[0]*(n+1)
 check=True
 for ind in range(len(s)-1,-1,-1):
  if(s[ind]=='1'):
   all_1[ind]+=(all_1[ind+1]+1)
   
 print(pizzatime(s,all_1,k))


def pizzatime(s,a,k):
 cont1,m_time=0,0
 for i in range(len(s)):
  if(s[i]=='1'):
   cont1+=1
  else:
   try:
    m_time=max(m_time,cont1+k+a[i+k])
   except:
    m_time=max(m_time,cont1+min(k,len(s)-i))
   cont1=0
 m_time=max(m_time,cont1)
 return m_time
   
  
for T in range(int(input())):
 n,k=list(map(int,input().split()))
 s=input()

 all_1=[0]*(n+1)
 check=True
 for ind in range(len(s)-1,-1,-1):
  if(s[ind]=='1'):
   all_1[ind]+=(all_1[ind+1]+1)
   
 print(pizzatime(s,all_1,k))


def pizzatime(s,a,k):
 cont1,m_time=0,0
 for i in range(len(s)):
  if(s[i]=='1'):
   cont1+=1
  else:
   try:
    m_time=max(m_time,cont1+k+a[i+k])
   except:
    m_time=max(m_time,cont1+min(k,len(s)-i))
   cont1=0
 m_time=max(m_time,cont1)
 return m_time
   
  
for T in range(int(input())):
 n,k=list(map(int,input().split()))
 s=input()

 all_1=[0]*(n+1)
 check=True
 for ind in range(len(s)-1,-1,-1):
  if(s[ind]=='1'):
   all_1[ind]+=(all_1[ind+1]+1)
   
 print(pizzatime(s,all_1,k))


def pizzatime(s,a,k):
 cont1,m_time=0,0
 for i in range(len(s)):
  if(s[i]=='1'):
   cont1+=1
  else:
   try:
    m_time=max(m_time,cont1+k+a[i+k])
   except:
    m_time=max(m_time,cont1+min(k,len(s)-i))
   cont1=0
 m_time=max(m_time,cont1)
 return m_time
   
  
for T in range(int(input())):
 n,k=list(map(int,input().split()))
 s=input()

 all_1=[0]*(n+1)
 check=True
 for ind in range(len(s)-1,-1,-1):
  if(s[ind]=='1'):
   all_1[ind]+=(all_1[ind+1]+1)
   
 print(pizzatime(s,all_1,k))


for _ in range(int(input())):
 (n,k)=(int(x) for x in input().split())
 a = input()
 hidari=[0]*n
 migi=[0]*n
 for i in range(n-k+1):
  loli=i
  i-=1
  num=0
  while i>=0:
   if a[i]=="1":
    num+=1
    i-=1
   else:
    break
  hidari[loli]=num
 for j in range(k-1,n):
  kaori=j
  j+=1
  num=0
  while j<=n-1:
   if a[j]=="1":
    num+=1
    j+=1
   else:
    break
  migi[kaori]=num
 if (n==k):
  print(n)
 else:
  max=0
  for i in range(n-k+1):
   if max<hidari[i]+k+migi[i+k-1]:
    max=hidari[i]+k+migi[i+k-1]
  print(max)


for _ in range(int(input())):
 n,k = map(int,input().split())
 arr = str(input())
 m = 0
 for i in range(n-k+1):
  count,j,l = k,i-1,i+k
  while j > -1 and j < n :
   if arr[j] == '1' :
    count,j = count + 1,j-1
   else :
    break
  while l < n and l > -1 :
   if arr[l] == '1' :
    count,l = count + 1,l + 1
   else :
    break
  m = max(m,count)
 print(m)

for _ in range(int(input())):
 n,k = list(map(int,input().split()))
 arr = str(input())
 m = 0
 for i in range(n-k+1):
  count = k
  j = i-1
  while j > -1 and j < n :
   if arr[j] == '1' :
    count += 1
    j -= 1
   else :
    break
  l = i+k
  while l < n and l > -1 :
   if arr[l] == '1' :
    count += 1
    l += 1
   else :
    break
  if count > m :
   m = count
 print(m)
   


# cook your dish here
for _ in range(int(input())):
 n,k=map(int,input().split())
 s=input()
 m=k
 head=[0]*n
 tail=[0]*n
 head[0]=0
 tail[-1]=0
 for i in range(1,n):
  if s[i-1]=='1':
   head[i]=1+head[i-1]
 for i in range(n-2,-1,-1):
  if s[i+1]=='1':
   tail[i]=1+tail[i+1]
 i=0
 
 while(i+k<=n):
  c=head[i]+k+tail[i+k-1]
  m=max(m,c)
  i+=1
 print(m)

# cook your dish here
for _ in range(int(input())):
 n,k=map(int,input().split())
 s=input()
 m=k
 head=[0]*n
 tail=[0]*n
 head[0]=0
 tail[-1]=0
 for i in range(1,n):
  if s[i-1]=='1':
   head[i]=1+head[i-1]
 for i in range(n-2,-1,-1):
  if s[i+1]=='1':
   tail[i]=1+tail[i+1]
 i=0
 
 while(i+k<=n):
  c=head[i]+k+tail[i+k-1]
  m=max(m,c)
  i+=1
 print(m)

num = int(input())

t=0
while(t<num):
 n,k = list(map(int,input().split()))
 s = str(input())

 count=0

 pos=[]
 for i in range(n):
  if(s[i]=="0"):
   pos.append(i)
 
 for i in range(len(pos)):
  ind = pos[i]
  val=0

  if(ind-k+1<0):
   val+=ind+1
  else:
   val+=k
   bn=ind-k
   while(bn>=0):
    if(s[bn]=="1"):
     val+=1
    else:
     break
    bn-=1
  if(i!=len(pos)-1):
   val+= pos[i+1]-pos[i]-1
  else:
   ui=0
   gh=pos[len(pos)-1]+1
   while(gh<n):
    if(s[gh]=="1"):
     ui+=1
    gh+=1
   val+=ui
  
  if(val>count):
   count=val
 if(len(pos)==0):
  print(n)
 else:
  print(count)
 t+=1



  


#!/usr/bin/env python3
def solve(n, k, s):
 l = [None] * (n + 1)
 l[0] = 0
 for i in range(n):
  if int(s[i]):
   l[i + 1] = l[i] + 1
  else:
   l[i + 1] = 0

 r = [None] * (n + 1)
 r[n] = 0
 for i in reversed(list(range(n))):
  if int(s[i]):
   r[i] = r[i + 1] + 1
  else:
   r[i] = 0

 ans = 0
 for i in range(n - k + 1):
  ans = max(ans, l[i] + k + r[i + k])
 return ans


def main():
 t = int(input())
 for _ in range(t):
  n, k = list(map(int, input().split()))
  s = input()
  print(solve(n, k, s))

def __starting_point():
 main()

__starting_point()

#!/usr/bin/env python3
def solve(n, k, s):
 l = [None] * (n + 1)
 l[0] = 0
 for i in range(n):
  if int(s[i]):
   l[i + 1] = l[i] + 1
  else:
   l[i + 1] = 0

 r = [None] * (n + 1)
 r[n] = 0
 for i in reversed(list(range(n))):
  if int(s[i]):
   r[i] = r[i + 1] + 1
  else:
   r[i] = 0

 ans = 0
 for i in range(n - k + 1):
  ans = max(ans, l[i] + k + r[i + k])
 return ans


def main():
 t = int(input())
 for _ in range(t):
  n, k = list(map(int, input().split()))
  s = input()
  print(solve(n, k, s))

def __starting_point():
 main()

__starting_point()

# cook your dish here
for t in range(int(input())):
 n,k = map(int,input().split())
 
 arr=list(input())
 
 for i in range(len(arr)):
  arr[i]=int(arr[i])
  
 head=[0 for i in range(n)]
 
 for i in range(1,n):
  if arr[i-1]==0:
   head[i]=0
  elif arr[i-1]==1:
   head[i]=head[i-1]+1
   
 tail=[0 for i in range(n)]
 
 for i in range(n-2,-1,-1):
  if arr[i+1]==0:
   tail[i]=0
  elif arr[i+1]==1:
   tail[i]=tail[i+1]+1
   
 ans=0
 j=0
 
 while j+k<=n:
  ans=max(ans,k+head[j]+tail[j+k-1])
  j+=1
 print(ans)

for _ in range(int(input())):
 a,k=map(int,input().split())
 inp=[int(i) for i in input()]
 conright=list(inp)
 prev=conright[0]
 for i in range(1,a):
  if conright[i]==1:
   if prev==1:
    conright[i]=conright[i-1]+1
   else:
    prev=conright[i]
  else:
   prev=conright[i]
 #print(conright)
 conleft=list(inp)
 prev=conleft[a-1]
 for i in range(a-2,-1,-1):
  if conleft[i]==1:
   if prev==1:
    conleft[i]=conleft[i+1]+1
   else:
    prev=conleft[i]
  else:
   prev=conleft[i]
 #print(conleft)
 conright.insert(0,0)
 conleft.append(0)
 m=-1
 for i in range(a-k+1):
  insr=conright[i-1]
  insl=conleft[i+k]
  m=max(m,k+conright[i]+conleft[i+k])
 print(m)

t = int(input())
for T in range(t):
 n, k = [int(x) for x in input().split()]
 s = input()
 l, r = [0] * n, [0] * n
 
 for i in range(1, n):
  if s[i - 1] == '1':
   l[i] = l[i - 1] + 1
 for i in range(n - 2, -1, -1):
  if s[i + 1] == '1':
   r[i] = r[i + 1] + 1

 ans = 0
 for i in range(n - k + 1):
  ans = max(ans, l[i] + k + r[i + k - 1])
 print(ans)


def fun(li,k): 
 
 # Initialize result 
 head=[0]*len(li)
 tail=[0]*len(li)
 for i in range(1,len(li)):
  if li[i-1]=="1":
   head[i]=head[i-1]+1
  else:
   head[i]=0
 for i in range(len(li)-2,-1,-1):
  if li[i+1]=="1":
   tail[i]=tail[i+1]+1
  else:
   tail[i]=0
 ans=0
#     print(head)
#     print(tail)
 for i in range(0,len(li)-k+1):
  ans=max(ans,k+head[i]+tail[i+k-1])
#         print(i,ans)
#     return ans
 
  
 return ans
t=int(input())
for i in range(0,t):
 s=list(map(int,input().strip().split()))
 s1=s[0]
 s2=s[1]
 li=input()
 print(fun(li,s2)) 

# cook your dish here
for _ in range (int(input())):
 n, k = map(int, input().split())
 l = list(input())
 l1 = [0] * n
 l2 = [0] * n
 for i in range (1, n):
  if l[i - 1] == "1":
   l1[i] = l1[i - 1] + 1
 for i in range (n - 2, -1, -1):
  if l[i + 1] == "1":
   l2[i] = l2[i + 1] + 1
 ans = 0
 for i in range (n - k + 1):
  ans = max(ans, (l1[i] + l2[i + k - 1] + k))
 #print(l1)
 #print(l2)
 print(ans)

for _ in range(int(input())):
 n,k = list(map(int,input().split()))
 arr = list(map(int,list(input())))
 right = [0]*(n+1)
 count = 0
 for i in range(n-1,-1,-1):
  if arr[i]==1:
   count += 1
  else:
   count = 0
  right[i] = count
 count = 0
 ans = 0
 for i in range(n):
  length = 0
  length = count + (min(i+k,n)-i) + right[min(i+k,n)]
  ans = max(ans,length)
  if arr[i] == 1:
   count += 1
  else:
   count = 0
 print(ans)

# 2
# 13 2
# 0101110000101
# 6 3
# 100001


for _ in range(int(input())):
 N, K = list(map(int, input().split()))
 A = ['0']
 A.extend(input())
 A.extend(['0'])

 B = [0] * (N + 2)
 C = B.copy()

 for i, j in enumerate(A[1:], start=1):
  if j == '1':
   B[i] = B[i - 1] + 1

 A.reverse()

 for i, j in enumerate(A[1:], start=1):
  if j == '1':
   C[i] = C[i - 1] + 1

 A.reverse()
 C.reverse()

 i = 1
 j = K
 ans = 0
 while j <= N:
  ans = max(ans, K + B[i - 1] + C[j + 1])
  i += 1
  j += 1

 print(ans)


te = int(input())
# print(te)
while te > 0:
 te -= 1
 n, k = list(map(int, input().split()))
 dishes = list(input())
 heads = [0]*n
 tails = [0]*n
 for i in range(1, n):
  if dishes[i-1] == '1':
   heads[i] = heads[i-1] + 1
  else:
   heads[i] = 0
 j = n-2
 while j >= 0:
  if dishes[j+1] == '1':
   tails[j] = tails[j+1] + 1
  else:
   tails[j] = 0
  j -= 1
 ans = 0
 i = 0
 while i + k <= n:
  ans = max(ans, heads[i] + k + tails[i+k-1])
  i += 1
 print(ans)

# cook your dish here
def fun(s):
 p=0;m=0
 for i in range(n-1):
  if s[i]=='1' and s[i+1]=='1':
   p+=1
  else:
   p=0
  m=max(m,p)
 return m+1
for __ in range(int(input())):
 n,k=map(int,input().split())
 s=input()
 r=0
 for i in range(n-k+1):
  s1='1'*k
  h=fun(s[:i]+s1+s[i+k:])
  r=max(r,h)
 print(r)

for z in range (int(input())):
 n,k=list(map(int,input().split()))
 s=input()
 maxl=0
 for i in range (0,n-k+1):
  j=i-1
  c0=0
  c1=0
  while(j>=0):
   if(s[j]=='1'):
    c0+=1
    j-=1
   else:
    break
  j=i+k
  while(j<n):
   if(s[j]=='1'):
    c1+=1
    j+=1
   else:
    break
  #print(c0,c1)
  if(maxl < (c0+c1+k)):
   maxl = c0+c1+k

 #if(n==k):
  #print(k)
 else:
  print(maxl)




def solve(arr,n,k):
 lbs = 0
 for i in range(0,n-k+1):
  cnt = k
  for j in range(i-1,-1,-1):
   if(arr[j]==1):
    cnt+=1
   else:
    break
  for j in range(i+k,n):
   if(arr[j]==1):
    cnt+=1
   else:
    break 
  lbs = max(lbs,cnt)
 return lbs

t = int(input())
while t>0:
 t-=1
 n,k = map(int,input().split())
 arr = list(map(int,list(input().strip())))
 print(solve(arr,n,k))