#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, d;
  cin >> n >> d;
  long long moves = n, tillnow = 0;
  while (moves) {
    tillnow++;
    if (tillnow % d == 0) moves++;
    moves--;
  }
  cout << tillnow;
}
