#include <bits/stdc++.h>
using namespace std;
int t, n, k;
string process(string s) {
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') {
      for (int j = max(0, i - k); j <= min(n - 1, i + k); j++) s[j] = '*';
    }
  }
  return s;
}
int main() {
  int ans, lol;
  cin >> t;
  string s;
  while (t--) {
    cin >> n >> k >> s;
    ans = 0;
    s = process(s);
    for (int i = 0; i < n; i++) {
      lol = 0;
      while (i < n && s[i] == '0') {
        i++;
        lol++;
      }
      ans += lol / (k + 1);
      if (lol % (k + 1) != 0) ans++;
    }
    cout << ans << endl;
  }
  return 0;
}
