#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  return a / g * b;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<int> v;
    for (int i = 0; s[i]; ++i) {
      if (s[i] == '1') {
        v.push_back(i);
      }
    }
    if (v.empty()) {
      cout << 1 + (n - 1) / (k + 1) << endl;
    } else {
      int ans = 0;
      for (int i = 1; i < v.size(); ++i) {
        int j = 2 * k + 1;
        while (v[i] - v[i - 1] - 1 >= j) {
          ans++;
          j += k + 1;
        }
      }
      ans += v[0] / (k + 1);
      ans += (n - 1 - v[v.size() - 1]) / (k + 1);
      cout << ans << endl;
    }
  }
}
