#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  long long c = 0;
  long long po = 0;
  for (long long i = 0; i < n; i++) {
    if (s[i] == 49) {
      c++;
      po = i;
    }
  }
  long long dist = 0;
  long long cnt = 1;
  for (long long i = 0; i < n; i++) {
    if (s[i] == 49) {
      if (dist < k) cnt--;
      dist = 0;
    } else if (i != 0) {
      dist++;
    }
    if (dist > k) {
      cnt++;
      dist = 0;
    }
  }
  cout << cnt << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
