#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, i = 2, p;
  cin >> n >> m;
  p = m;
  while (n >= p) {
    n++;
    p = i * m;
    i++;
  }
  cout << n;
}
