import math L,K=map(int,input().split()) print(math.ceil((0.5*L/K)-1)*K)