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