//AC 代码:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 4e5 + 10;
ll a[maxn];
int main(){
int t, n, k;
cin>>t;
while(t--){
cin>>n>>k;
for(int i = 1; i <= n; i++){
scanf("%lld", &a[i]);
}
int x = 0;
int ans = 0;
for(int st = 1; st <= n;){
while(st + x + 1<= n && a[st + x] < 2*a[st + x + 1]){
x++;
}
if(x < k){
st = st + x + 1;
x = 0;
}else{
ans = ans + (x - k + 1);
st = st + x + 1;
x = 0;
}
}
cout<<ans<<endl;
}
return 0;
}