a,b = map(int, input().split()) a = int(a/2) div = a // b mod = a % b if mod == 0: print((div-1) * b) else: print(div * b)