L, K = map(int,input().split()) eaten = 0 for i in range(L//K): if L - 2*K > 0: L -= 2*K eaten += K else: break print(eaten)