You are given a binary string of length $n$ (i. e. a string consisting of $n$ characters '0' and '1').

In one move you can swap two adjacent characters of the string. What is the lexicographically minimum possible string you can obtain from the given one if you can perform no more than $k$ moves? It is possible that you do not perform any moves at all.

Note that you can swap the same pair of adjacent characters with indices $i$ and $i+1$ arbitrary (possibly, zero) number of times. Each such swap is considered a separate move.

You have to answer $q$ independent test cases.


-----Input-----

The first line of the input contains one integer $q$ ($1 \le q \le 10^4$) — the number of test cases.

The first line of the test case contains two integers $n$ and $k$ ($1 \le n \le 10^6, 1 \le k \le n^2$) — the length of the string and the number of moves you can perform.

The second line of the test case contains one string consisting of $n$ characters '0' and '1'.

It is guaranteed that the sum of $n$ over all test cases does not exceed $10^6$ ($\sum n \le 10^6$).


-----Output-----

For each test case, print the answer on it: the lexicographically minimum possible string of length $n$ you can obtain from the given one if you can perform no more than $k$ moves.


-----Example-----
Input
3
8 5
11011010
7 9
1111100
7 11
1111100

Output
01011110
0101111
0011111



-----Note-----

In the first example, you can change the string as follows: $1\underline{10}11010 \rightarrow \underline{10}111010 \rightarrow 0111\underline{10}10 \rightarrow 011\underline{10}110 \rightarrow 01\underline{10}1110 \rightarrow 01011110$. 

In the third example, there are enough operations to make the string sorted.

Difficulty: introductory

Starter code:

Solutions:
q=int(input())
for t in range(q):
    n,k=map(int,input().split())
    a=input()
    ko=0
    used=[0]*n
    ans=''
    g=True
    for i in range(n):
        if a[i]=='1':
            ko+=1
        else:
            if ko<=k:
                k-=ko
                ans=ans+'0'
            else:
                for j in range(ko-k):
                    ans=ans+'1'
                ans=ans+'0'
                for j in range(k):
                    ans=ans+'1'
                for j in range(i+1,n):
                    ans=ans+a[j]
                print(ans)
                g=False
                break
    if g==True:
        for j in range(ko):
            ans=ans+'1'
        print(ans)

'''
https://codeforces.com/contest/1256/problem/D
'''


q = int(input())
for _ in range(q):
    n, k = map(int, input().split())
    s = list(input())
    l = 0
    for i in range(n):
        if k <= 0:
            break
        if s[i] == '0':
            if k >= i - l:
                s[i] = s[l]
                s[l] = '0'
                k -= i - l
                l += 1
            else:
                s[i] = s[i - k]
                s[i - k] = '0'
                break
    print(''.join(s))

for _ in range(int(input())):
    n,k=map(int,input().split())
    s=input()
    zeroes=[]
    for i in range(n):
        if s[i]=='0':
            zeroes.append(i)
    s=list(s)
    ind=0 
    le=len(zeroes)
    i=0 
   # print(zeroes)
    while i<n:
      #  print(k)
        if s[i]=='1':
            while ind<le and zeroes[ind]<i:
                ind+=1 
            if ind==le:
                break
            a=zeroes[ind]
            #print(a)
           # print(i,a)
            if a-i<=k:
                k-=(a-i)
                s[i],s[a]=s[a],s[i]
                #print(s)
                ind+=1 
            #ind+=1 
        i+=1 
    print(''.join(s))

import bisect


q = int(input())
for _ in range(q):
    n, k = list(map(int, input().split()))
    s = input()
    ans = []
    for i in range(n):
        if s[i] == "0":
            ans.append(i)
    cnt = 0
    for i, pos in enumerate(ans):
        if cnt + pos - i <= k:
            cnt += (pos - i)
        else:
            res = list("0"*i + "1"*(pos-i) + s[pos:])
            res[pos] = "1"
            res[pos - (k-cnt)] = "0"
            print("".join(res))
            break
    else:
        print("0"*len(ans) + "1"*(n-len(ans)))
    


import sys
input = sys.stdin.readline

q=int(input())
for testcases in range(q):
    n,k=list(map(int,input().split()))
    S=input().strip()

    count=0
    LIST=[0]

    for s in S:
        if s=="1":
            count+=1
        else:
            LIST.append(count)

    ind=1
    while ind<len(LIST) and k>0:
        if LIST[ind]<=k:
            k-=LIST[ind]
            LIST[ind]=0
        else:
            LIST[ind]-=k
            k=0
        ind+=1

    #print(LIST)

    ones=0
    ANS=[]

    for i in range(1,len(LIST)):
        ANS+=[1]*(LIST[i]-LIST[i-1])
        ANS.append(0)
    ANS+=[1]*(count-LIST[-1])

    print("".join(map(str,ANS)))

    
            
        

    


import io, sys, atexit, os
import math as ma
from decimal import Decimal as dec
from itertools import permutations
from itertools import combinations


def li ():
	return list (map (int, sys.stdin.readline ().split ()))


def num ():
	return map (int, sys.stdin.readline ().split ())


def nu ():
	return int (input ())


def find_gcd ( x, y ):
	while (y):
		x, y = y, x % y
	return x


def lcm ( x, y ):
	gg = find_gcd (x, y)
	return (x * y // gg)


mm = 1000000007


def solve ():
	t = nu()
	for tt in range (t):
		n,k=num()
		s=list(input())
		ol=[0]*(n+1)
		move=0
		last=0
		ind=-1
		for i in range(n):
			if(s[i]=="0"):
				ox=i-last
				if(k-ox>=0):
					k-=ox
				else:
					ind=i
					break
				last+=1
		if(ind==-1):
			s.sort()
			print(*s,sep="")
		else:
			op=s[0:ind]
			oz=s[ind:]
			op.sort()
			op+=oz
			while(k>0):
				op[ind-1],op[ind]=op[ind],op[ind-1]
				ind-=1
				k-=1
			print(*op,sep="")









def __starting_point():
	solve ()
__starting_point()

import sys
q = int(input())
for qi in range(q):
    n, k = list(map(int, input().split()))
    s = list(input())
    s = [0 if x == '0' else 1 for x in s]
    zc = oc = 0
    found = False
    for i in range(len(s)):
        if s[i] == 1:
            oc += 1
        else:
            if oc <= k:
                k -= oc
                zc += 1
            else:
                res = [0] * zc
                res += [1] * (oc - k)
                res += [0]
                res += [1] * k
                res += s[i + 1:]
                print(''.join(str(x) for x in res))
                found = True
                break
    if not found:
        res = [0] * zc
        res += [1] * oc
        print(''.join(str(x) for x in res))



q = int(input())
#q = 1
for _ in range(q):
    n, k = map(int, input().split())

    line = list(input())

    zero = 0
    non_zero = 0
    while zero < n:
        if line[zero] != '0':
            zero += 1
            continue
        pos = zero
        # print("<", line, zero)
        if zero - non_zero < k:
            k -= zero - non_zero
            line[zero] = '1'
            line[non_zero] = '0'
            non_zero += 1
        else:
            line[zero - k] = '0'
            line[zero] = '1'
            break
        # print(">", line, zero)
        # print()
        if k == 0:
            break
        zero += 1
    print(*line, sep="")

q = int(input())
while q > 0:
    q -= 1
    n, d = list(map(int, input().split()))
    s = input()
    l =[]
    for c in s:
        l.append(c)
    j = 0
    ans = ["" for i in range(n)]
    for i in range(n):
        if l[i] == "0":
            if i - j <= d:
                ans[j] = "0"
                l[i] = "*"
                d -= (i-j)
                j += 1
            else:
                ans[i-d] = "0"
                l[i] = "*"
                break
    i = 0
    index = 0
    while i < n:
        while l[index] == "*":
            index += 1
            if index >= n:
                break
        if index >= n:
            break
        if ans[i] == "":
            ans[i] = l[index]
            index += 1
        i += 1
    for k in ans:
        print(k, end = "")
    print()

    
    
    print()
    

        

from collections import deque
import sys
input = sys.stdin.readline

q = int(input())
for _ in range(q):
    n, k = list(map(int, input().split()))
    s = input()
    ans = deque()
    cnt = 0
    flg = 1
    for i in range(n):
        if flg:
            if s[i] == '0':
                if i - cnt <= k:
                    ans.appendleft(0)
                    k -= i - cnt
                    cnt += 1
                else:
                    flg = 0
                    j = i - k
            else:
                ans.append(1)
        else:
            ans.append(int(s[i]))
    if flg:
        print(''.join(map(str, ans)))
    else:
        ans = list(ans)
        ans1 = ans[:j]
        ans2 = ans[j:]
        print(''.join(map(str, ans1)) + '0' + ''.join(map(str, ans2)))


for _ in range(int(input())):
    n, k = map(int, input().split())
    s = [*input()]
    t = 0
    ans = ['1'] * n

    for i in range(n):
        if s[i] == '0':
            z = min(k, i - t)
            k -= z
            ans[i - z] = '0'
            t += 1

    print(''.join(ans))

q = int(input())
for __ in [0]*q:
    n,k = list(map(int,input().split()))
    a = list(input())
    q = k
    p = -1
    res = []
    for i in range(n):
        if p == -1 and a[i] == '1':
            p = i
            res.append('1')
        elif p != -1 and a[i] == '0':
            if q >= i-p:
                res[p] = '0'
                res.append('1')
                q -= i-p
                p += 1
            else:
                if q != 0:
                    res[i-q] = '0'
                    res.append('1')
                    q = 0
                else:
                    res.append('0')
        else:
            res.append(a[i])
    ans = ''.join(res)
    print(ans)
        
        
    



t = int(input())
for _ in range(t):
    n,k = list(map(int, input().split()))
    s = input()
    ans = ""
    ones = 0
    zeros = 0
    flag = 0
    for i in range(n):
        if(s[i]=="1"):
            ones = ones + 1
        else:
            if(k>=ones): # would go to start
                k = k - ones
                zeros = zeros + 1
            else:
  #              print(zeros)
                
 #               print(ones-k)
#                print(s[i+1:])
                ans = "0"*zeros + "1"*(ones-k) + "0" + "1"*k + s[i+1:]
                flag = 1
                break
    if(flag==0):
        ans = "0"*zeros + "1"*ones
    print(ans)




q = int(input())
for _ in q*' ':
  n, k = map(int, input().split())
  s = list(input())
  i = 0
  t = k
  c = 0
  while i < n and s[i] == '0':
    i += 1
    c += 1
  while i < n and k > 0:
    if s[i] == '0':
      u = min(i-c, k)
      k -= u
      s[i], s[i-u] = s[i-u], s[i]
      c += 1
    i += 1
  print(*s, sep='')

from collections import deque

for __ in range(int(input())):
    n, k = list(map(int, input().split()))
    ar = list(map(int, input()))
    lol = deque([])
    for i in range(n):
        if ar[i] == 0:
            lol.append(i)
    i = 0
    while lol and len(lol) > i and lol[i] == i:
        i += 1
    num = i
    for __ in range(i):
        lol.popleft()
    while lol and k > 0:
        x = lol[0]
        if k >= x - num:
            k -= x
            k += num
            lol.popleft()
            i += 1
            num += 1
        else:
            break
    ans = []
    for j in range(i):
        ans.append(0)
    if lol:
        lol[0] -= k
    for j in range(i, n):
        if lol and j == lol[0]:
            ans.append(0)
            lol.popleft()
        else:
            ans.append(1)
    print(''.join(map(str, ans)))

import sys


def main():
    for _ in range(int(input())):
        n, k = get_ints()
        s = list(input())
        x = []
        for i in range(n):
            if s[i] == "0":
                x.append((i, i - len(x)))
        i = 0
        while k > 0 and i < len(x):
            if x[i][1] < k:
                s[i], s[x[i][0]] = s[x[i][0]], s[i]
                k -= x[i][1]
                i += 1
            else:
                s[x[i][0] - k], s[x[i][0]] = s[x[i][0]], s[x[i][0] - k]
                break
        print(*s, sep="")


input = lambda: sys.stdin.readline().strip()
get_ints = lambda: map(int, input().split())
get_array = lambda: list(map(int, input().split()))
main()


import sys
def I():
    return sys.stdin.readline().rstrip()

q = int( I() )
for _ in range( q ):
    n, k = list(map( int, I().split() ))
    l = I()
    r = []
    o = 0
    for i in l:
        if i == '1':
            o += 1
        else:
            t = max( 0, o - k )
            r.extend( [ '1' ] * t )
            o -= t
            k -= o
            r.append( '0' )
    r.extend( [ '1' ] * o )
    print( "".join( r ) )


t=int(input())
while t>0:
    t-=1
    n,k=list(map(int,input().split()))
    z=[]
    a=list(input())
    for i in range(n):
        if a[i]=='0':
            z.append(i)
    y=0
    #print(z)
    for i in range(len(z)):
        if k-(z[i]-y)>0:
            k-=(z[i]-y)
            z[i]=y
            y+=1
        else:
            z[i]-=k
            break
    v=[0 for i in range(n)]    
    for i in range(len(z)):
        a[z[i]]='0'
        v[z[i]]=1
    for i in range(n):
        if v[i]==0:
            a[i]='1'
    print("".join(a))        


t = int(input())
while(t > 0):
    t -= 1
    a = list(map(int, input().split()))
    s = input()
    ans = ""
    tmp = 0
    n = a[0]
    k = a[1]
    for i in range(n):
        if k >= 0 :
            if(s[i] == '1'):
                tmp += 1
                if(i == n-1):
                    for x in range(tmp): ans += '1'
            else:
                if(k >= tmp):
                    ans += '0'
                    if(i == n-1):
                        for x in range(tmp): ans += '1'
                else:
                    for x in range(tmp - k): ans += '1'
                    ans += '0'
                    for x in range(k):ans += '1'
                k-=tmp
        else:ans += s[i]        
    print(ans)

import sys
import itertools
import math
import collections
from collections import Counter

#########################
# imgur.com/Pkt7iIf.png #
#########################

def sieve(n):
    prime = [True for i in range(n + 1)]
    p = 2
    while (p * p <= n):
        if (prime[p] == True):
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 1
    prime[0] = prime[1] = False
    r = [p for p in range(n + 1) if prime[p]]
    return r
def divs(n, start=1):
    r = []
    for i in range(start, int(math.sqrt(n) + 1)):
        if (n % i == 0):
            if (n / i == i):
                r.append(i)
            else:
                r.extend([i, n // i])
    return r
def ceil(n, k): return n // k + (n % k != 0)
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(map(int, input().split()))
def lcm(a, b): return abs(a * b) // math.gcd(a, b)
def prr(a, sep=' '): print(sep.join(map(str, a)))
def dd(): return collections.defaultdict(int)

t = ii()
for _ in range(t):
    n, k = mi()
    s = input()
    state = []
    pos = 0
    for i in range(n):
        if s[i] == '0':
            if k != 0 and i - pos <= k:
                state.append(pos)
                k -= (i - pos)
                pos += 1
            elif k != 0:
                state.append(i - k)
                k = 0
            else:
                state.append(i)
    res = [1]*n
    for i in state:
        res[i] = 0
    prr(res, '')

def __starting_point():

    q = int(input())

    for t in range(q):
        n, k = [int(i) for i in input().split(" ")]
        s = list(input())

        zero = []
        for i in range(len(s)):
            if s[i] == '0':
                zero.append(i)

        var = 0
        index = 0

        while k > 0 and var < len(zero) and index < len(s):
            temp = zero[var]
            if k < zero[var]-index:
                s[zero[var]-k], s[zero[var]] = s[zero[var]], s[zero[var]-k]
                k = 0
            else:
                s[index], s[zero[var]] = s[zero[var]], s[index]
                k -= zero[var]-index
            var += 1
            index += 1

        print("".join(s))




__starting_point()

def solve(k, bits):
    indices = []
    for i, b in enumerate(bits):
        if b == '0':
            indices.append(i)
    cur = k
    for i in range(len(indices)):
        index = indices[i]
        move = index - i
        if move > cur:
            indices[i] = index - cur
            break
        else:
            indices[i] = i
            cur -= move
    ans = ['1'] * len(bits)
    for index in indices:
        ans[index] = '0'
    return ''.join(ans)


def __starting_point():
    q = int(input())
    for _ in range(q):
        n, k = [int(r) for r in input().split(' ')]
        print(solve(k, input()))

__starting_point()

t = int(input())
for test in range(t):
    n,k = [int(x) for x in input().split()]
    s = list(input())

    zer = []
    for i in range(n):
        if s[i]=='0':
            zer.append(i)
    curr = 0
    #print(s)
    while k>0 and curr<len(zer):
        if curr==0:
            swaps=zer[curr]
        else:
            swaps = zer[curr]-zer[curr-1]-1

        if swaps>k:
            swaps = k
        #print(swaps,'ss')
        if swaps==0:
            curr+=1
            continue

        x = zer[curr]
        y = x-swaps
        s[x]='1'
        #print(s,y)
        s[y]='0'
        k = k-swaps
        zer[curr]=y
        curr+=1
        #print(s)

    for i in range(n):
        print(s[i],end="")
    print()


from collections import defaultdict
from math import sqrt,factorial,gcd,log2,inf,ceil
# map(int,input().split())
# l = list(map(int,input().split()))
mod = 10**9 + 7


q = int(input())

for _ in range(q):
    n,k = list(map(int,input().split()))
    s = list(input())
    cnt = 0
    flag = 0
    yo = 0
    ha = 0
    for i in range(n):

        if s[i] == '0':
            if cnt<=k:
                k-=cnt
                yo+=1
            else:
                flag = 1
                ha = k
                break
        else:
            cnt+=1
    if flag == 0:
        z = list(map(int,s))
        z.sort()
        z = list(map(str,z))
        print(''.join(z))

    else:
        ans = []
        for i in range(yo):
            ans.append('0')
        cnt = 0
        ma = 0

        for j,i in enumerate(s):
            if i == '1':
                ma+=1
            if i == '0':
                cnt+=1
            if cnt > yo:
                posn = j
                break
        z = ['1'*(ma-ha) + '0']+['1'*(ha)]
        z1 = s[posn+1:]
        ans+=z+z1
        print(''.join(ans))