L, K = map(int, input().split()) m, r = divmod(L, K) if m % 2 == 0 and r == 0: print(((m//2) - 1)*K) else: print(m//2 * K)