#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B;
  cin >> A >> B;
  int sum = 0;
  for (int i = 1; A != 0; i++, A--) {
    sum++;
    if (i % B == 0) A++;
  }
  cout << sum << endl;
}
