#include #include #include #include #include #include #include using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); ll N, D; cin >> N >> D; if(N % D == 0) { cout << N / D - 1 << endl; return 0; } ll skip = D - N % D; ll ans = 0; ans += N / D * D / skip; ll rem = N % D; ans += rem / skip; cout << ans - 1 << endl; }