#include <bits/stdc++.h>
using namespace std;
int check(int m, int k, string s) {
  int i;
  for (i = m + 1; i <= m + k && i < s.size(); i++) {
    if (s[i] == '1') return i;
  }
  return -1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t > 0) {
    int i = 0, n, k, m, s = 0;
    string a;
    cin >> n >> k >> a;
    for (i = 0; i < n;) {
      int temp = check(i, k, a);
      if (temp == -1) {
        if (a[i] == '0') {
          s++;
        }
        i += (k + 1);
      } else
        i = temp;
    }
    cout << s << endl;
    t--;
  }
  return 0;
}
