#include using namespace std; #define int long long signed main(){ int q; cin >> q; while(q--){ int n, k; cin >> n >> k; int ans = 0; int now = k; int num = 1; while(num < n){ num += now; ans++; now *= k; } cout << ans << endl; } return 0; }