#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  cin >> k;
  while (k--) {
    int a, b;
    cin >> a >> b;
    int c = b;
    int t = 0;
    for (int i = 0; i < a; i++) {
      char k;
      cin >> k;
      if (k == '0') c++;
      if (k == '1') {
        c -= b;
        t += c / (b + 1);
        c = 0;
      }
    }
    t += c / (b + 1);
    cout << t << endl;
  }
  return 0;
}
