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