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