#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long MAX = 1e6;
const long long INF = 2e9;
void solve() {
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<long long> z;
  for (long long i = 0; i < n; i++)
    if (s[i] == '0') z.push_back(i);
  vector<long long> ans(n, 1);
  long long j = 0;
  for (long long idx : z) {
    if (idx - j <= k) {
      k -= idx - j;
      ans[j] = 0;
      j++;
    } else {
      ans[idx - k] = 0;
      j = idx - k;
      k = 0;
    }
  }
  for (long long i = 0; i < n; i++) {
    cout << ans[i];
  }
  cout << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long _;
  cin >> _;
  while (_--) solve();
  return 0;
}
