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