#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, v[100], a = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) v[i] = i * m;
  a = n;
  for (int i = 1; i <= a; i++) {
    if (v[i] <= n) n++;
  }
  cout << n << endl;
  return 0;
}
