/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--){
        int n,m;
        cin>>n>>m;
        string s,p;
        cin>>s;
        p=s;
        if(s=="0"){
            std::cout << "1" << std::endl;
            continue;
        }
        for(int i=0;i<min(n,m);i++){
           s=p;
            for(int i=0;i<n;i++){
                if(i==0 && s[i]=='0' && s[i+1]=='1'){
                    p[i]='1';
                }
                else if(i==n-1 && s[i]=='0' && s[i-1]=='1'){
                    p[i]='1';
                }else if(s[i+1]=='1' && s[i-1]=='0' ||  s[i+1]=='0' && s[i-1]=='1' && s[i]=='0'){
                    p[i]='1';
                }
                
            }
            
        }
        std::cout << p << std::endl;
    }

    return 0;
}