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