import sys input = sys.stdin.buffer.readline L, K = map(int, input().split()) ans = (K * (L // (2 * K))) print(ans if L % (2 * K) != 0 else ans - K)