#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int pop = 0; pop < t; pop++) {
    long long q, k;
    cin >> q >> k;
    string s;
    cin >> s;
    long long i = 0;
    long long res = 0;
    while (i < q) {
      if (s[i] == '1') {
        i += k;
      } else {
        int p = i + 1;
        int flag = 0;
        while (p <= (k + i) && p < q) {
          if (s[p] == '1') {
            i = p - 1;
            flag = 1;
            break;
          }
          p++;
        }
        if (flag == 0) {
          res += 1;
          i += k;
        }
      }
      i++;
    }
    cout << res << endl;
  }
}
