import sys def input(): return sys.stdin.readline().rstrip() def main(): L, K = map(int, input().split()) print((L-1)//(2*K) * K) if __name__ == '__main__': main()