#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  cin >> n >> k;
  string A;
  cin >> A;
  vector<int> vec;
  for (int i = 0; i < n; i++) {
    if (A[i] == '1') {
      vec.push_back(i + 1);
    }
  }
  int ans = 0;
  if (vec.size() == 0) {
    cout << (n + k) / (k + 1) << '\n';
    return;
  }
  int ii = 1;
  int cnt = 0;
  while (ii <= n) {
    if (ii + k + 1 <= vec[0]) {
      cnt += 1;
    } else
      break;
    ii = ii + k + 1;
  }
  for (int i = 0; i < vec.size() - 1; i++) {
    ii = vec[i] + k + 1;
    while (ii < n) {
      if (ii + k + 1 <= vec[i + 1]) {
        cnt += 1;
      } else
        break;
      ii = ii + k + 1;
    }
  }
  ii = vec[vec.size() - 1] + k + 1;
  while (ii <= n) {
    cnt += 1;
    ii = k + ii + 1;
  }
  cout << cnt << '\n';
  return;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
}
