# -*- coding: utf-8 -*- L, K = map(int, raw_input().split()) N = L // (2 * K) if L % (2 * K) == 0: N -= 1 print N * K