#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    long long n, k, i, c = 0, t;
    string s;
    cin >> n >> k >> s;
    vector<int> v;
    vector<bool> a(n);
    for (i = 0; i < s.size(); i++)
      if (s[i] == '0') v.push_back(i);
    for (i = 0; i < v.size(); i++) {
      t = min(k, v[i] - i);
      k -= t;
      v[i] -= t;
      a[v[i]] = 1;
    }
    for (i = 0; i < n; i++)
      if (a[i] == 1)
        cout << '0';
      else
        cout << '1';
    cout << endl;
  }
}
