#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, a, b;
  string s;
  scanf("%lld", &t);
  vector<int> v;
  while (t--) {
    v.clear();
    scanf("%lld%lld", &a, &b);
    cin >> s;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == '0') v.push_back(i);
    }
    int w = -1;
    for (int i = 0; i < v.size(); i++) {
      if (b > v[i] - w - 1) {
        b = b - (v[i] - w - 1);
        v[i] = w + 1;
        w = v[i];
      } else {
        v[i] = v[i] - b;
        break;
      }
    }
    v.push_back(1000025);
    int k = 0;
    for (int i = 0; i < a; i++) {
      if (i == v[k]) {
        cout << "0";
        k++;
      } else {
        cout << "1";
      }
    }
    cout << endl;
  }
}
