#include <iostream>
using namespace std;
int main(){
int t, n, k, j, ans = 0;
cin >> t;
while(t--){
cin >> n >> k;
if(k == 0){
j = 1;
}
for(int i = 1; i <= n; i++){
if(n/i == k){
ans++;
}
}
if(k == 0) {
cout << j;
}else{
cout << ans;
}
ans = 0;
}
return 0;
}