#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, k, l, cn, m, w;
  string s;
  vector<int> v;
  cin >> t;
  for (int z = 0; z < t; z++) {
    l = 0;
    cn = 0;
    m = 0;
    cin >> n >> k;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == '1') {
        l++;
        v.push_back(i + 1);
      }
    }
    if (s.size() == 1 && s[0] == '0') {
      cn = 1;
    } else if (s.size() == 1 && s[0] == '1') {
      cn = 0;
    } else if (l == 0) {
      n = n - 1;
      cn = n / (k + 1);
      cn++;
    } else {
      m = 0;
      w = 0;
      if (s[0] == '0') {
        m = v[0] - 1;
        cn = m / (k + 1);
      }
      m = 0;
      w = 0;
      if (s[s.size() - 1] == '0') {
        m = s.size() - v[v.size() - 1];
        w = m / (k + 1);
        cn += w;
      }
      if (v.size() >= 2) {
        m = 0;
        w = 0;
        for (int i = 0; i < v.size() - 1; i++) {
          m = v[i + 1] - (v[i] + 1) - k;
          w = m / (k + 1);
          cn += w;
        }
      }
    }
    cout << cn << endl;
    v.clear();
  }
  return 0;
}
