#include <bits/stdc++.h>
using namespace std;
int main() {
  int h_socks, n_socks;
  cin >> h_socks >> n_socks;
  for (int i = 0; i < h_socks; i = i + n_socks) {
    h_socks++;
  }
  cout << h_socks - 1;
  return 0;
}
