#include<cstdio>
using namespace std;
typedef long long ll;
#define N 100010
ll s[N];
int ch[N];
int houkou(int i, int j, int k){
ll cross = (j-i)*(s[k]-s[j])-(k-j)*(s[j]-s[i]);
return (cross>0)-(cross<0);
}
int main(){
int T;
scanf("%d", &T);
while(T--){
int n, k;
scanf("%d%d ", &n, &k);
s[0] = 0;
for(int i=1; i<=n; i++){
s[i] = s[i-1] + (getchar()-48);
}
int l=0, r=k, len=1, op=1;
ch[1] = 0;
for(int i=k+1; i<=n; i++){
while(len>=2 && houkou(ch[len-1], ch[len], i-k)!=1){
if(op == len) op--;
len--;
}
ch[++len] = i-k;
while(op<len && houkou(ch[op], ch[op+1], i)!=-1) op++;
ll a=(s[i]-s[ch[op]])*(r-l), b=(s[r]-s[l])*(i-ch[op]);
if(a>b || (a==b && (i-ch[op] < r-l))){
l = ch[op], r = i;
}
}
printf("%d %d\n", l+1, r);
}
return 0;
}
I2luY2x1ZGU8Y3N0ZGlvPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKCiNkZWZpbmUgTiAxMDAwMTAKbGwgc1tOXTsKaW50IGNoW05dOwppbnQgaG91a291KGludCBpLCBpbnQgaiwgaW50IGspewogICAgbGwgY3Jvc3MgPSAoai1pKSooc1trXS1zW2pdKS0oay1qKSooc1tqXS1zW2ldKTsKICAgIHJldHVybiAoY3Jvc3M+MCktKGNyb3NzPDApOwp9CgppbnQgbWFpbigpewogICAgaW50IFQ7CiAgICBzY2FuZigiJWQiLCAmVCk7CiAgICB3aGlsZShULS0pewogICAgICAgIGludCBuLCBrOwogICAgICAgIHNjYW5mKCIlZCVkICIsICZuLCAmayk7CiAgICAgICAgc1swXSA9IDA7CiAgICAgICAgZm9yKGludCBpPTE7IGk8PW47IGkrKyl7CiAgICAgICAgICAgIHNbaV0gPSBzW2ktMV0gKyAoZ2V0Y2hhcigpLTQ4KTsKICAgICAgICB9CiAgICAgICAgaW50IGw9MCwgcj1rLCBsZW49MSwgb3A9MTsKICAgICAgICBjaFsxXSA9IDA7CiAgICAgICAgZm9yKGludCBpPWsrMTsgaTw9bjsgaSsrKXsKICAgICAgICAgICAgd2hpbGUobGVuPj0yICYmIGhvdWtvdShjaFtsZW4tMV0sIGNoW2xlbl0sIGktaykhPTEpewogICAgICAgICAgICAgICAgaWYob3AgPT0gbGVuKSBvcC0tOwogICAgICAgICAgICAgICAgbGVuLS07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY2hbKytsZW5dID0gaS1rOwogICAgICAgICAgICB3aGlsZShvcDxsZW4gJiYgaG91a291KGNoW29wXSwgY2hbb3ArMV0sIGkpIT0tMSkgb3ArKzsKICAgICAgICAgICAgbGwgYT0oc1tpXS1zW2NoW29wXV0pKihyLWwpLCBiPShzW3JdLXNbbF0pKihpLWNoW29wXSk7CiAgICAgICAgICAgIGlmKGE+YiB8fCAoYT09YiAmJiAoaS1jaFtvcF0gPCByLWwpKSl7CiAgICAgICAgICAgICAgICBsID0gY2hbb3BdLCByID0gaTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBwcmludGYoIiVkICVkXG4iLCBsKzEsIHIpOwogICAgfQogICAgcmV0dXJuIDA7Cn0K