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