#include <bits/stdc++.h>
const int MOD = 1e9;
const int N = 100003;
using namespace std;
string process(int n, long long int k, string s) {
  int j = 0;
  while (j < n && s[j] == '0') j++;
  for (int i = j + 1; i < n; i++)
    if (s[i] == '0') {
      long long int tmp = min(k, (long long int)(i - j));
      k -= tmp;
      s[i] = '1';
      s[i - tmp] = '0';
      if (k == 0) break;
      j++;
    }
  return s;
}
int main() {
  int q;
  cin >> q;
  while (q--) {
    int n;
    long long int k;
    scanf("%d", &n);
    scanf("%I64d", &k);
    string s;
    cin >> s;
    cout << process(n, k, s) << endl;
  }
  return 0;
}
