#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define vi vector<int>
#define vs vector<string>
#define vii vector<pii>
#define vvi vector<vector<int>>
#define vvii vector<vector<pii>>
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define sz(x) (int)x.size()
#define all(v) (v).begin(), (v).end()   
#define ret(x) return cout<<x,0;
#define rety return cout<<"YES",0;
#define retn return cout<<"NO",0;
#define fl fflush(stdout)   
#define hell 1000000007
#define hell2 998244353 
#define pi 3.14159265358979323846

int solve(){
    int n,m;
    cin >> n >> m;
    string s,a;
    cin >> s;
    a = s;
    for(int i = 0; i < min(m,n); i++){
        int x{};
        for(int j = 0; j < n; j++){
            if(j == 0){
                if(s[1] == '1' && s[0] == '0')
                    a[0] = '1';
                x++;    
            }
            else if(j == n-1){
                if(s[n-1] == '0' && s[n-2] == '1')
                    a[n-1] = '1';
                x++;
            }
            else{
                if((s[j-1] == '1' && s[j+1] == '0' && s[j] == '0') || (s[j-1] == '0' && s[j+1] == '1' && s[j] == '0'))
                    a[j] = '1';
                x++;    
            }
        }
        s = a;
        if(x == 0)
            break;
    }
    cout << s << endl;
    
    return 0;
}
    
signed main(){
    IOS;
    int tp=1;
	cin>>tp;
    while(tp--){
        solve();
    }
    
    return 0;
}


