#include using namespace std; int main() { int n, k, ans = 0; cin >> n >> k; cout << n + (n - 1) / (k - 1) << endl; return 0; }