N, D = map(int, input().split()) if N % D == 0: print(N // D - 1) else: print(N - 1)