#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n,k,ans=0,f=0;
char c;
cin>>n>>k;
for(int i=1;i<=n;i++)
{
cin>>c;
if(c=='1')
{
ans+=(i-f-1)/(k+1);
f=i;
}
}
if(f==0)
{
ans+=1+(n-1)/(k+1);
}
else
{
ans+=(n-f)/(k+2);
}
cout<<ans<<endl;
}
return 0;
}