#include <bits/stdc++.h>
int main() {
  int jumlah_kaoskaki, haribrp;
  scanf("%d %d", &jumlah_kaoskaki, &haribrp);
  int hari = 0;
  while (jumlah_kaoskaki > 0) {
    hari++;
    jumlah_kaoskaki--;
    if (hari % haribrp == 0) {
      jumlah_kaoskaki++;
    }
  }
  printf("%d\n", hari);
  return 0;
}
