L, K = map(int, input().split()) print((__import__('math').ceil(L/2/K)-1)*K)