L,K = map(int,input().split()) L = L/2 if L%K == 0:print(int((L//K -1)*K)) else:print(int((L//K)*K))