#include using namespace std; typedef long long ll; int main(){ ll h,a; cin >> h >> a; ll check=a; ll t=1; ll su = 1; while(check<=h){ check*=a; su += t+1; t++; } cout << su << endl; }