import sys sys.setrecursionlimit(10 ** 6) def main(): l, k = map(int, input().split()) a, r = divmod(l, 2 * k) if r == 0: a -= 1 print(a * k) main()