#include <bits/stdc++.h>
using namespace std;

#define rep(i, a) for(int i=0;i<a;i++)
#define repA(i,a,b)for(int i=a;i<b;i++)
#define l list
#define v vector
#define u_m unordered_map
typedef long long ll;
const int mxN=101,MOD=1e9+7;
void solve(){
	int n,m,count=1,r=0;
	cin>>n>>m;
	string s;
	cin>>s;
	while(count>0&&r<m){
		string cop=s;
		count=0;
		rep(i,n){
			if(s[i]=='0'){
			int cr=0;
			if(i-1>=0&&s[i-1]=='1')cr++;
			if(i+1<n&&s[i+1]=='1')cr++;
			if(cr==1){
				cop[i]='1';
				count++;
			}
			}
		}
		s=cop;
		r++;
	}
	cout<<s<<endl;
}
int main(){
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	int t;
	cin>>t;
	while(t--){
		solve();
	}
}
