#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define pb push_back
const ll INF=1e18+10;

void solve()
{
    ll n,m;
    cin>>n>>m;
    string s;
    cin>>s;
    string p=s;
    while(m--)
    {
        s=p;
        for(ll i=0;i<n;i++)
        {
            if(p[i]=='1') continue;
            else{
            if(i==0)
            {
               // cout<<"YES"<<endl;
                if(s[i+1]=='1') p[i]='1';
                else p[i]='0';
                //cout<<p[i]<<endl;
            }
           else if(i==n-1)
            {
                if(s[i-1]=='1') p[i]='1';
                else p[i]='0';
            }
            else
            {
                if((s[i-1]=='1'&&s[i+1]=='0')||(s[i+1]=='1'&&s[i-1]=='0')) p[i]='1';
                else p[i]='0';
            }
        }
        }
        if(p==s) break;
    }

    cout<<p<<endl;
   // cout<<p[0]<<endl;

}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t;
    t=1;
   cin>>t;
    while(t--)
    {
        solve();
    }
}
