#include<bits/stdc++.h> using namespace std; int n,k; int main () { while (cin>>n>>k) printf ("%d\n",n+(n-1)/(k-1)); return 0; }