l,k=(int(i) for i in input().split()) print(int((l-1)/(2*k))*k)