#include <bits/stdc++.h>
using namespace std;
int n, T;
long long k;
string s;
queue<int> arr;
void prepare() {
  for (int i = 0; i < n; i++)
    if (s[i] == '0') arr.push(i);
}
void Try(int pos) {
  if (pos >= n) {
    cout << endl;
    return;
  }
  if (arr.empty())
    cout << "1";
  else {
    int res = arr.front();
    long long v = res - pos;
    if (v <= k)
      k -= v, cout << "0", arr.pop();
    else
      cout << "1";
  }
  Try(pos + 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> T;
  while (T > 0) {
    cin >> n >> k >> s;
    prepare();
    Try(0);
    T--;
  }
  return 0;
}
