n=raw_input() N=map(int, n.split()) c=0 L, K=N[0], N[1] yuu=0 cnt=L/(K*2) if L%(K*2)==0: cnt-=1 yuu+=K*cnt print yuu