#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<int> vec;
    for (int i = 0; i < n; i++) {
      if (s[i] == '1') {
        vec.push_back(i);
      }
    }
    int m = vec.size();
    if (m == 0) {
      int curr = 0;
      int counter = 0;
      while (curr < n) {
        counter += 1;
        curr = curr + k + 1;
      }
      cout << counter << endl;
      continue;
    }
    int counter = 0;
    for (int i = 1; i < m; i++) {
      int l = vec[i - 1];
      int r = vec[i];
      int curr = l + k + 1;
      while (curr < r && r - curr > k) {
        counter += 1;
        curr = curr + k + 1;
      }
    }
    int curr = 0;
    while (curr < vec[0] && vec[0] - curr > k) {
      counter += 1;
      curr = curr + k + 1;
    }
    curr = vec[m - 1] + k + 1;
    while (curr < n) {
      counter += 1;
      curr = curr + k + 1;
    }
    cout << counter << endl;
  }
}
