l,k = map(int, raw_input().split()) t = l / (2*k) if t * 2 * k == l: t -= 1 print t*k