#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n;
  while (~scanf("%d%d", &m, &n)) {
    int b = 0, flag = 0;
    while (m--) {
      flag++;
      if (flag % n == 0) m++;
    }
    cout << flag << endl;
  }
  return 0;
}
