#include <bits/stdc++.h>
using namespace std;
long long int test, flag, n, i, p, sum, S, l, r, m, x, y, XD, j, j_1, k, k1,
    res, min_, flag1, max_, XD1, count_, dick_size1, s_size;
char ch[200010], ch_1[2000100];
string s;
char c;
long long int pl, mi, a, b, suck, ans, arr_even[1000100], ajib_arr[5000500],
    arr[5000500];
char garbage;
set<long long int> sex;
set<long long int>::iterator it;
struct voxchod {
  long long int a, b;
} square[3001000];
bool comp(voxchod x, voxchod y) { return x.a < y.a; }
bool com(long long int a, long long int b) { return a > b; }
int main() {
  cin >> test;
  while (test--) {
    cin >> n >> x;
    cin >> s;
    arr[0] = 0;
    i = 1;
    for (j = 0; s[j]; j++) {
      if (s[j] == '1') arr[i] = j + x + 1, i++;
    }
    arr[i] = n + x + x + 1;
    i++;
    count_ = 0;
    for (j = 1; j < i; j++) {
      if ((arr[j] - arr[j - 1] - 1 - x) / (x + 1) > 0)
        count_ += (arr[j] - arr[j - 1] - 1 - x) / (x + 1);
    }
    cout << count_ << endl;
  }
  return 0;
}
