#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  cin >> t;
  while (t--) {
    long long int n, k;
    cin >> n >> k;
    string s, s1;
    cin >> s;
    for (long long int i = 1; i <= k; i++) {
      s1 += "0";
    }
    s = s1 + s + s1;
    long long int seats = 2 * k + 1;
    long long int count = 0, ans = 0;
    for (long long int i = 0; i <= s.size() - 1; i++) {
      if (s[i] == '0') {
        count++;
      } else {
        if (count >= seats) {
          ans += (count - k) / (k + 1);
        }
        count = 0;
      }
    }
    if (count >= seats) {
      ans += (count - k) / (k + 1);
    }
    cout << ans;
    cout << endl;
  }
  return 0;
}
