#include <bits/stdc++.h>
using namespace std;
int n, k;
string s;
void solve() {}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long test = 1;
  cin >> test;
  while (test--) {
    cin >> n >> k;
    cin >> s;
    int ans = 0;
    int cnt = 0;
    for (long long i = 0; i < (n); ++i) {
      if (s[i] == '0')
        cnt++;
      else {
        if (i == cnt && cnt >= k + 1)
          ans += (cnt - 1 - k) / (k + 1) + 1;
        else
          ans += (cnt - k) / (k + 1);
        cnt = 0;
      }
    }
    if (cnt == n)
      cout << 1 + (cnt - 1) / (k + 1);
    else
      cout << ans + cnt / (k + 1);
    solve();
    cout << "\n";
  }
}
