L,K=map(int,input().split()) i=1 while 1: if L-K*i*2 <= 0: break i+=1 print(K*(i-1))