#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  set<long long int> st;
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') st.insert(i);
  }
  if (st.empty()) {
    if (n % (k + 1) == 0)
      cout << n / (k + 1) << endl;
    else
      cout << (n / (k + 1)) + 1 << endl;
  } else {
    vector<bool> v(n, true);
    for (auto it : st) {
      int i;
      if (it - k < 0)
        i = 0;
      else
        i = it - k;
      for (; i <= it + k && i < n; i++) v[i] = false;
    }
    int ct = 0, ans = 0;
    for (int i = 0; i < n; i++) {
      if (v[i])
        ct++;
      else if (ct > 0) {
        if (ct % (k + 1) == 0)
          ans += (ct / (k + 1));
        else
          ans += ((ct / (k + 1)) + 1);
        ct = 0;
      }
    }
    if (ct > 0) {
      if (ct % (k + 1) == 0)
        ans += (ct / (k + 1));
      else
        ans += ((ct / (k + 1)) + 1);
    }
    cout << ans << endl;
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
