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