#include <bits/stdc++.h>
using namespace std;
long long func(long long l, long long r, long long k) {
  if (l > r) return 0;
  long long len = r - l + 1;
  long long d = len / (k + 1) + min((long long)1, len % (k + 1));
  return d;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  long long l = s.length();
  vector<long long> ones;
  for (long long i = 0; i < l; i++) {
    if (s[i] == '1') ones.push_back(i);
  }
  if (ones.empty()) {
    cout << func(0, l - 1, k) << endl;
    return;
  }
  long long ans = 0;
  ans += func(0, ones[0] - k - 1, k);
  for (long long i = 1; i < ones.size(); i++) {
    long long l = ones[i - 1] + k + 1;
    long long r = ones[i] - k - 1;
    ans += func(l, r, k);
  }
  ans += func(ones.back() + k + 1, l - 1, k);
  cout << ans << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
}
