#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define f(i,q,n) for(int i=(int)q;i<n;i++)
#define pb push_back
#define debug(x) cout<<#x<<" "<<x<<endl;
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    cin>>t;
    while(t--){
        int n,m;
        cin>>n>>m;
        string s;
        cin>>s;
        while(m--){
        string ans=s;
        f(i,0,n){
            if(i==0 and ans[i]=='0' and ans[i+1]=='1'){s[i]='1';}
            else if(i==n-1 and ans[i]=='0' and ans[i-1]=='1'){s[i]='1';}
            else{
                if(i<n-1 and i>0 and ans[i]=='0' and ans[i+1]!=ans[i-1]){
                    s[i]='1';
                }
            }
        }
        if(s==ans){
            break;
        }


        }
        
    cout<<s<<endl;

    }
    return 0;
}
//check constraints, testcases, ll vs int 
