#include <bits/stdc++.h>
using namespace std;
int main() {
  int test;
  cin >> test;
  while (test--) {
    long long int n, k;
    cin >> n >> k;
    string a;
    cin >> a;
    vector<long long int> v;
    v.push_back(0);
    for (long long int i = 0; i < n; i++) {
      if (a[i] == '1') v.push_back(i);
    }
    v.push_back(n - 1);
    long long int x = v.size();
    if (k >= n - 1) {
      if (x == 2)
        cout << 1 << endl;
      else
        cout << 0 << endl;
    } else if (x > 3) {
      long long int c = 0;
      for (long long int i = 2; i < x - 1; i++) {
        long long int second = (v[i] - v[i - 1]) / (k + 1);
        second--;
        c += second;
      }
      if (v[0] != v[1]) {
        long long int second = (v[1] - v[0]) / (k + 1);
        c += second;
      }
      if (v[x - 1] != v[x - 2]) {
        long long int second = (v[x - 1] - v[x - 2]) / (k + 1);
        c += second;
      }
      cout << c << endl;
    } else if (x == 3) {
      long long int c = 0;
      if (v[0] != v[1]) {
        long long int second = (v[1] - v[0]) / (k + 1);
        c += second;
      }
      if (v[x - 1] != v[x - 2]) {
        long long int second = (v[x - 1] - v[x - 2]) / (k + 1);
        c += second;
      }
      cout << c << endl;
    } else {
      cout << (v[1] - v[0]) / (k + 1) + 1 << endl;
    }
  }
  return 0;
}
