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