#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, days = 0;
  cin >> n >> m;
  days = n + ((n - 1) / (m - 1));
  cout << days << "\n";
  return 0;
}
