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

int main() {
    ll t;
    cin>>t;
    while(t)
    {
        int n,m;
        cin>>n>>m;
        string s;
        string temp = "";
        for(int i=0;i<n;i++)
        {
            temp = temp + '0';
        }
        cin>>s;
        for(int j=0;j<min(n, m) ;j++)
        {
            for(int i=0;i<n;i++)
            {
                temp[i] = s[i];
            }
            for(int i = 0;i<n;i++)
            {
                if(i == 0)
                {
                    if(s[i] == '0' && s[i+1] == '1')
                    {
                        temp[i] = '1';
                    }
                }
                else if(i == n-1)
                {
                    if(s[i] == '0' && s[i-1] == '1')
                    {
                        temp[i] = '1';
                    }
                }
                else
                {
                    if(s[i] == '0')
                    {
                        if((s[i+1] == '1' && s[i-1] == '0') || (s[i+1] == '0' && s[i-1] == '1'))
                        {
                            temp[i] = '1';
                        }
                    }
                }
            }
            s = temp;
            //cout<<s<<"\n";
            //cout<<temp<<'\n';
        }
        
        cout<<s<<"\n";
        t--;
    }
    return 0;
}