#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int i, n, m, c = 0;
  cin >> n >> m;
  if (n == m) {
    cout << n + 1 << endl;
  } else if (n < m) {
    cout << n << endl;
  } else {
    for (i = 1; i * m <= n; i++) {
      n++;
    }
    cout << n << endl;
  }
}
