#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, k;
  string s;
  cin >> t;
  while (t--) {
    cin >> n >> k;
    cin.ignore(1, '\n');
    cin >> s;
    queue<int> q;
    for (int i = 0; i < n; i++) {
      if (s[i] == '1') q.push(i);
    }
    int start = 0, ans = 0;
    while (!q.empty()) {
      int front = q.front();
      int low = front - k, high = front + k;
      if (start < low) {
        ans += 1;
        start = start + k + 1;
      } else {
        start = high + 1;
        q.pop();
      }
    }
    while (start < n) {
      ans += 1;
      start = start + k + 1;
    }
    cout << ans << endl;
  }
}
