L, K = map(int, input().split(' ')) l = K*(L//K//2) if L % (2 * K)==0: print(l-K) else: print(l)