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.
[{"code": "q=int(input())\nfor t in range(q):\n    n,k=map(int,input().split())\n    a=input()\n    ko=0\n    used=[0]*n\n    ans=''\n    g=True\n    for i in range(n):\n        if a[i]=='1':\n            ko+=1\n        else:\n            if ko<=k:\n                k-=ko\n                ans=ans+'0'\n            else:\n                for j in range(ko-k):\n                    ans=ans+'1'\n                ans=ans+'0'\n                for j in range(k):\n                    ans=ans+'1'\n                for j in range(i+1,n):\n                    ans=ans+a[j]\n                print(ans)\n                g=False\n                break\n    if g==True:\n        for j in range(ko):\n            ans=ans+'1'\n        print(ans)", "passed": true, "time": 0.15, "memory": 14196.0, "status": "done"}, {"code": "'''\nhttps://codeforces.com/contest/1256/problem/D\n'''\n\n\nq = int(input())\nfor _ in range(q):\n    n, k = map(int, input().split())\n    s = list(input())\n    l = 0\n    for i in range(n):\n        if k <= 0:\n            break\n        if s[i] == '0':\n            if k >= i - l:\n                s[i] = s[l]\n                s[l] = '0'\n                k -= i - l\n                l += 1\n            else:\n                s[i] = s[i - k]\n                s[i - k] = '0'\n                break\n    print(''.join(s))", "passed": true, "time": 0.15, "memory": 14048.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    n,k=map(int,input().split())\n    s=input()\n    zeroes=[]\n    for i in range(n):\n        if s[i]=='0':\n            zeroes.append(i)\n    s=list(s)\n    ind=0 \n    le=len(zeroes)\n    i=0 \n   # print(zeroes)\n    while i<n:\n      #  print(k)\n        if s[i]=='1':\n            while ind<le and zeroes[ind]<i:\n                ind+=1 \n            if ind==le:\n                break\n            a=zeroes[ind]\n            #print(a)\n           # print(i,a)\n            if a-i<=k:\n                k-=(a-i)\n                s[i],s[a]=s[a],s[i]\n                #print(s)\n                ind+=1 \n            #ind+=1 \n        i+=1 \n    print(''.join(s))", "passed": true, "time": 1.63, "memory": 14104.0, "status": "done"}, {"code": "import bisect\n\n\nq = int(input())\nfor _ in range(q):\n    n, k = list(map(int, input().split()))\n    s = input()\n    ans = []\n    for i in range(n):\n        if s[i] == \"0\":\n            ans.append(i)\n    cnt = 0\n    for i, pos in enumerate(ans):\n        if cnt + pos - i <= k:\n            cnt += (pos - i)\n        else:\n            res = list(\"0\"*i + \"1\"*(pos-i) + s[pos:])\n            res[pos] = \"1\"\n            res[pos - (k-cnt)] = \"0\"\n            print(\"\".join(res))\n            break\n    else:\n        print(\"0\"*len(ans) + \"1\"*(n-len(ans)))\n    \n", "passed": true, "time": 0.19, "memory": 14244.0, "status": "done"}, {"code": "import sys\ninput = sys.stdin.readline\n\nq=int(input())\nfor testcases in range(q):\n    n,k=list(map(int,input().split()))\n    S=input().strip()\n\n    count=0\n    LIST=[0]\n\n    for s in S:\n        if s==\"1\":\n            count+=1\n        else:\n            LIST.append(count)\n\n    ind=1\n    while ind<len(LIST) and k>0:\n        if LIST[ind]<=k:\n            k-=LIST[ind]\n            LIST[ind]=0\n        else:\n            LIST[ind]-=k\n            k=0\n        ind+=1\n\n    #print(LIST)\n\n    ones=0\n    ANS=[]\n\n    for i in range(1,len(LIST)):\n        ANS+=[1]*(LIST[i]-LIST[i-1])\n        ANS.append(0)\n    ANS+=[1]*(count-LIST[-1])\n\n    print(\"\".join(map(str,ANS)))\n\n    \n            \n        \n\n    \n", "passed": true, "time": 0.15, "memory": 14328.0, "status": "done"}, {"code": "import io, sys, atexit, os\nimport math as ma\nfrom decimal import Decimal as dec\nfrom itertools import permutations\nfrom itertools import combinations\n\n\ndef li ():\n\treturn list (map (int, sys.stdin.readline ().split ()))\n\n\ndef num ():\n\treturn map (int, sys.stdin.readline ().split ())\n\n\ndef nu ():\n\treturn int (input ())\n\n\ndef find_gcd ( x, y ):\n\twhile (y):\n\t\tx, y = y, x % y\n\treturn x\n\n\ndef lcm ( x, y ):\n\tgg = find_gcd (x, y)\n\treturn (x * y // gg)\n\n\nmm = 1000000007\n\n\ndef solve ():\n\tt = nu()\n\tfor tt in range (t):\n\t\tn,k=num()\n\t\ts=list(input())\n\t\tol=[0]*(n+1)\n\t\tmove=0\n\t\tlast=0\n\t\tind=-1\n\t\tfor i in range(n):\n\t\t\tif(s[i]==\"0\"):\n\t\t\t\tox=i-last\n\t\t\t\tif(k-ox>=0):\n\t\t\t\t\tk-=ox\n\t\t\t\telse:\n\t\t\t\t\tind=i\n\t\t\t\t\tbreak\n\t\t\t\tlast+=1\n\t\tif(ind==-1):\n\t\t\ts.sort()\n\t\t\tprint(*s,sep=\"\")\n\t\telse:\n\t\t\top=s[0:ind]\n\t\t\toz=s[ind:]\n\t\t\top.sort()\n\t\t\top+=oz\n\t\t\twhile(k>0):\n\t\t\t\top[ind-1],op[ind]=op[ind],op[ind-1]\n\t\t\t\tind-=1\n\t\t\t\tk-=1\n\t\t\tprint(*op,sep=\"\")\n\n\n\n\n\n\n\n\n\ndef __starting_point():\n\tsolve ()\n__starting_point()", "passed": true, "time": 1.77, "memory": 14296.0, "status": "done"}, {"code": "import sys\nq = int(input())\nfor qi in range(q):\n    n, k = list(map(int, input().split()))\n    s = list(input())\n    s = [0 if x == '0' else 1 for x in s]\n    zc = oc = 0\n    found = False\n    for i in range(len(s)):\n        if s[i] == 1:\n            oc += 1\n        else:\n            if oc <= k:\n                k -= oc\n                zc += 1\n            else:\n                res = [0] * zc\n                res += [1] * (oc - k)\n                res += [0]\n                res += [1] * k\n                res += s[i + 1:]\n                print(''.join(str(x) for x in res))\n                found = True\n                break\n    if not found:\n        res = [0] * zc\n        res += [1] * oc\n        print(''.join(str(x) for x in res))\n\n", "passed": true, "time": 0.15, "memory": 14144.0, "status": "done"}, {"code": "q = int(input())\n#q = 1\nfor _ in range(q):\n    n, k = map(int, input().split())\n\n    line = list(input())\n\n    zero = 0\n    non_zero = 0\n    while zero < n:\n        if line[zero] != '0':\n            zero += 1\n            continue\n        pos = zero\n        # print(\"<\", line, zero)\n        if zero - non_zero < k:\n            k -= zero - non_zero\n            line[zero] = '1'\n            line[non_zero] = '0'\n            non_zero += 1\n        else:\n            line[zero - k] = '0'\n            line[zero] = '1'\n            break\n        # print(\">\", line, zero)\n        # print()\n        if k == 0:\n            break\n        zero += 1\n    print(*line, sep=\"\")", "passed": true, "time": 0.14, "memory": 14140.0, "status": "done"}, {"code": "from collections import deque\nimport sys\ninput = sys.stdin.readline\n\nq = int(input())\nfor _ in range(q):\n    n, k = list(map(int, input().split()))\n    s = input()\n    ans = deque()\n    cnt = 0\n    flg = 1\n    for i in range(n):\n        if flg:\n            if s[i] == '0':\n                if i - cnt <= k:\n                    ans.appendleft(0)\n                    k -= i - cnt\n                    cnt += 1\n                else:\n                    flg = 0\n                    j = i - k\n            else:\n                ans.append(1)\n        else:\n            ans.append(int(s[i]))\n    if flg:\n        print(''.join(map(str, ans)))\n    else:\n        ans = list(ans)\n        ans1 = ans[:j]\n        ans2 = ans[j:]\n        print(''.join(map(str, ans1)) + '0' + ''.join(map(str, ans2)))\n", "passed": true, "time": 0.15, "memory": 14256.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    n, k = map(int, input().split())\n    s = [*input()]\n    t = 0\n    ans = ['1'] * n\n\n    for i in range(n):\n        if s[i] == '0':\n            z = min(k, i - t)\n            k -= z\n            ans[i - z] = '0'\n            t += 1\n\n    print(''.join(ans))", "passed": true, "time": 0.14, "memory": 14080.0, "status": "done"}, {"code": "q = int(input())\nfor __ in [0]*q:\n    n,k = list(map(int,input().split()))\n    a = list(input())\n    q = k\n    p = -1\n    res = []\n    for i in range(n):\n        if p == -1 and a[i] == '1':\n            p = i\n            res.append('1')\n        elif p != -1 and a[i] == '0':\n            if q >= i-p:\n                res[p] = '0'\n                res.append('1')\n                q -= i-p\n                p += 1\n            else:\n                if q != 0:\n                    res[i-q] = '0'\n                    res.append('1')\n                    q = 0\n                else:\n                    res.append('0')\n        else:\n            res.append(a[i])\n    ans = ''.join(res)\n    print(ans)\n        \n        \n    \n\n", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "t = int(input())\nfor _ in range(t):\n    n,k = list(map(int, input().split()))\n    s = input()\n    ans = \"\"\n    ones = 0\n    zeros = 0\n    flag = 0\n    for i in range(n):\n        if(s[i]==\"1\"):\n            ones = ones + 1\n        else:\n            if(k>=ones): # would go to start\n                k = k - ones\n                zeros = zeros + 1\n            else:\n  #              print(zeros)\n                \n #               print(ones-k)\n#                print(s[i+1:])\n                ans = \"0\"*zeros + \"1\"*(ones-k) + \"0\" + \"1\"*k + s[i+1:]\n                flag = 1\n                break\n    if(flag==0):\n        ans = \"0\"*zeros + \"1\"*ones\n    print(ans)\n\n\n", "passed": true, "time": 0.14, "memory": 14128.0, "status": "done"}, {"code": "q = int(input())\nfor _ in q*' ':\n  n, k = map(int, input().split())\n  s = list(input())\n  i = 0\n  t = k\n  c = 0\n  while i < n and s[i] == '0':\n    i += 1\n    c += 1\n  while i < n and k > 0:\n    if s[i] == '0':\n      u = min(i-c, k)\n      k -= u\n      s[i], s[i-u] = s[i-u], s[i]\n      c += 1\n    i += 1\n  print(*s, sep='')", "passed": true, "time": 0.15, "memory": 14084.0, "status": "done"}, {"code": "from collections import deque\n\nfor __ in range(int(input())):\n    n, k = list(map(int, input().split()))\n    ar = list(map(int, input()))\n    lol = deque([])\n    for i in range(n):\n        if ar[i] == 0:\n            lol.append(i)\n    i = 0\n    while lol and len(lol) > i and lol[i] == i:\n        i += 1\n    num = i\n    for __ in range(i):\n        lol.popleft()\n    while lol and k > 0:\n        x = lol[0]\n        if k >= x - num:\n            k -= x\n            k += num\n            lol.popleft()\n            i += 1\n            num += 1\n        else:\n            break\n    ans = []\n    for j in range(i):\n        ans.append(0)\n    if lol:\n        lol[0] -= k\n    for j in range(i, n):\n        if lol and j == lol[0]:\n            ans.append(0)\n            lol.popleft()\n        else:\n            ans.append(1)\n    print(''.join(map(str, ans)))", "passed": true, "time": 0.14, "memory": 14364.0, "status": "done"}, {"code": "import sys\n\n\ndef main():\n    for _ in range(int(input())):\n        n, k = get_ints()\n        s = list(input())\n        x = []\n        for i in range(n):\n            if s[i] == \"0\":\n                x.append((i, i - len(x)))\n        i = 0\n        while k > 0 and i < len(x):\n            if x[i][1] < k:\n                s[i], s[x[i][0]] = s[x[i][0]], s[i]\n                k -= x[i][1]\n                i += 1\n            else:\n                s[x[i][0] - k], s[x[i][0]] = s[x[i][0]], s[x[i][0] - k]\n                break\n        print(*s, sep=\"\")\n\n\ninput = lambda: sys.stdin.readline().strip()\nget_ints = lambda: map(int, input().split())\nget_array = lambda: list(map(int, input().split()))\nmain()\n", "passed": true, "time": 0.14, "memory": 14368.0, "status": "done"}, {"code": "import sys\ndef I():\n    return sys.stdin.readline().rstrip()\n\nq = int( I() )\nfor _ in range( q ):\n    n, k = list(map( int, I().split() ))\n    l = I()\n    r = []\n    o = 0\n    for i in l:\n        if i == '1':\n            o += 1\n        else:\n            t = max( 0, o - k )\n            r.extend( [ '1' ] * t )\n            o -= t\n            k -= o\n            r.append( '0' )\n    r.extend( [ '1' ] * o )\n    print( \"\".join( r ) )\n", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "t=int(input())\nwhile t>0:\n    t-=1\n    n,k=list(map(int,input().split()))\n    z=[]\n    a=list(input())\n    for i in range(n):\n        if a[i]=='0':\n            z.append(i)\n    y=0\n    #print(z)\n    for i in range(len(z)):\n        if k-(z[i]-y)>0:\n            k-=(z[i]-y)\n            z[i]=y\n            y+=1\n        else:\n            z[i]-=k\n            break\n    v=[0 for i in range(n)]    \n    for i in range(len(z)):\n        a[z[i]]='0'\n        v[z[i]]=1\n    for i in range(n):\n        if v[i]==0:\n            a[i]='1'\n    print(\"\".join(a))        \n", "passed": true, "time": 0.23, "memory": 14168.0, "status": "done"}, {"code": "t = int(input())\nwhile(t > 0):\n    t -= 1\n    a = list(map(int, input().split()))\n    s = input()\n    ans = \"\"\n    tmp = 0\n    n = a[0]\n    k = a[1]\n    for i in range(n):\n        if k >= 0 :\n            if(s[i] == '1'):\n                tmp += 1\n                if(i == n-1):\n                    for x in range(tmp): ans += '1'\n            else:\n                if(k >= tmp):\n                    ans += '0'\n                    if(i == n-1):\n                        for x in range(tmp): ans += '1'\n                else:\n                    for x in range(tmp - k): ans += '1'\n                    ans += '0'\n                    for x in range(k):ans += '1'\n                k-=tmp\n        else:ans += s[i]        \n    print(ans)", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "import sys\nimport itertools\nimport math\nimport collections\nfrom collections import Counter\n\n#########################\n# imgur.com/Pkt7iIf.png #\n#########################\n\ndef sieve(n):\n    prime = [True for i in range(n + 1)]\n    p = 2\n    while (p * p <= n):\n        if (prime[p] == True):\n            for i in range(p * 2, n + 1, p):\n                prime[i] = False\n        p += 1\n    prime[0] = prime[1] = False\n    r = [p for p in range(n + 1) if prime[p]]\n    return r\ndef divs(n, start=1):\n    r = []\n    for i in range(start, int(math.sqrt(n) + 1)):\n        if (n % i == 0):\n            if (n / i == i):\n                r.append(i)\n            else:\n                r.extend([i, n // i])\n    return r\ndef ceil(n, k): return n // k + (n % k != 0)\ndef ii(): return int(input())\ndef mi(): return map(int, input().split())\ndef li(): return list(map(int, input().split()))\ndef lcm(a, b): return abs(a * b) // math.gcd(a, b)\ndef prr(a, sep=' '): print(sep.join(map(str, a)))\ndef dd(): return collections.defaultdict(int)\n\nt = ii()\nfor _ in range(t):\n    n, k = mi()\n    s = input()\n    state = []\n    pos = 0\n    for i in range(n):\n        if s[i] == '0':\n            if k != 0 and i - pos <= k:\n                state.append(pos)\n                k -= (i - pos)\n                pos += 1\n            elif k != 0:\n                state.append(i - k)\n                k = 0\n            else:\n                state.append(i)\n    res = [1]*n\n    for i in state:\n        res[i] = 0\n    prr(res, '')", "passed": true, "time": 0.14, "memory": 14392.0, "status": "done"}, {"code": "def __starting_point():\n\n    q = int(input())\n\n    for t in range(q):\n        n, k = [int(i) for i in input().split(\" \")]\n        s = list(input())\n\n        zero = []\n        for i in range(len(s)):\n            if s[i] == '0':\n                zero.append(i)\n\n        var = 0\n        index = 0\n\n        while k > 0 and var < len(zero) and index < len(s):\n            temp = zero[var]\n            if k < zero[var]-index:\n                s[zero[var]-k], s[zero[var]] = s[zero[var]], s[zero[var]-k]\n                k = 0\n            else:\n                s[index], s[zero[var]] = s[zero[var]], s[index]\n                k -= zero[var]-index\n            var += 1\n            index += 1\n\n        print(\"\".join(s))\n\n\n\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 14356.0, "status": "done"}, {"code": "def solve(k, bits):\n    indices = []\n    for i, b in enumerate(bits):\n        if b == '0':\n            indices.append(i)\n    cur = k\n    for i in range(len(indices)):\n        index = indices[i]\n        move = index - i\n        if move > cur:\n            indices[i] = index - cur\n            break\n        else:\n            indices[i] = i\n            cur -= move\n    ans = ['1'] * len(bits)\n    for index in indices:\n        ans[index] = '0'\n    return ''.join(ans)\n\n\ndef __starting_point():\n    q = int(input())\n    for _ in range(q):\n        n, k = [int(r) for r in input().split(' ')]\n        print(solve(k, input()))\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "t = int(input())\nfor test in range(t):\n    n,k = [int(x) for x in input().split()]\n    s = list(input())\n\n    zer = []\n    for i in range(n):\n        if s[i]=='0':\n            zer.append(i)\n    curr = 0\n    #print(s)\n    while k>0 and curr<len(zer):\n        if curr==0:\n            swaps=zer[curr]\n        else:\n            swaps = zer[curr]-zer[curr-1]-1\n\n        if swaps>k:\n            swaps = k\n        #print(swaps,'ss')\n        if swaps==0:\n            curr+=1\n            continue\n\n        x = zer[curr]\n        y = x-swaps\n        s[x]='1'\n        #print(s,y)\n        s[y]='0'\n        k = k-swaps\n        zer[curr]=y\n        curr+=1\n        #print(s)\n\n    for i in range(n):\n        print(s[i],end=\"\")\n    print()\n", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "from collections import defaultdict\nfrom math import sqrt,factorial,gcd,log2,inf,ceil\n# map(int,input().split())\n# l = list(map(int,input().split()))\nmod = 10**9 + 7\n\n\nq = int(input())\n\nfor _ in range(q):\n    n,k = list(map(int,input().split()))\n    s = list(input())\n    cnt = 0\n    flag = 0\n    yo = 0\n    ha = 0\n    for i in range(n):\n\n        if s[i] == '0':\n            if cnt<=k:\n                k-=cnt\n                yo+=1\n            else:\n                flag = 1\n                ha = k\n                break\n        else:\n            cnt+=1\n    if flag == 0:\n        z = list(map(int,s))\n        z.sort()\n        z = list(map(str,z))\n        print(''.join(z))\n\n    else:\n        ans = []\n        for i in range(yo):\n            ans.append('0')\n        cnt = 0\n        ma = 0\n\n        for j,i in enumerate(s):\n            if i == '1':\n                ma+=1\n            if i == '0':\n                cnt+=1\n            if cnt > yo:\n                posn = j\n                break\n        z = ['1'*(ma-ha) + '0']+['1'*(ha)]\n        z1 = s[posn+1:]\n        ans+=z+z1\n        print(''.join(ans))\n\n", "passed": true, "time": 0.21, "memory": 14336.0, "status": "done"}]