#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const long long MAXN = 1e6 + 7;
const long double pi = acos(-1);
inline long long read() {
  long long x = 0, ff = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * ff;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long pow1(long long p, long long d, long long P) {
  return d ? (pow1(p * p % P, d >> 1, P) * (d & 1 ? p : 1)) % P : 1;
}
vector<long long> prime;
bool is_composite[MAXN];
void sieve(long long n) {
  std::fill(is_composite, is_composite + n, false);
  for (long long i = 2; i < n; ++i) {
    if (!is_composite[i]) prime.push_back(i);
    for (long long j = 0; j < prime.size() && i * prime[j] < n; ++j) {
      is_composite[i * prime[j]] = true;
      if (i % prime[j] == 0) break;
    }
  }
}
long long modInverse(long long a, long long m) {
  long long m0 = m, y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m, t = m;
    m = a % m;
    a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
void doit() {
  long long n = read();
  long long k = read();
  string s;
  cin >> s;
  long long p = 0;
  for (long long i = 0; i < n; ++i) p += s[i] ^ 49;
  if (p == n) {
    cout << (n + k) / (k + 1);
    return;
  }
  vector<long long> v;
  v.push_back(-k - 1);
  for (long long i = 0; i < n; ++i)
    if (s[i] ^ 48) v.push_back(i);
  v.push_back(n + k);
  p = 0;
  for (long long i = 0; i < v.size() - 1; ++i) {
    long long q = (v[i + 1] - v[i] - 1 - k) / (k + 1);
    p += q;
  }
  cout << p;
}
int main() {
  for (long long t = read(); t--; cout << '\n') doit();
  return 0;
}
