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