#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n, i = 1;
  cin >> n >> m;
  while (1) {
    if (n >= (m * i))
      n++;
    else
      break;
    i++;
  }
  cout << n;
  return 0;
}
