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