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