#include using namespace std; int main(){ int n,k; cin>>n>>k; int tmp=n; int js=n; while(tmp>k){ js+=int(tmp/k); tmp=tmp%k+tmp/k; } cout<