L,K=map(int, input().split()) i=0 Y=0 K2=2*K #rint(K2) L-=1 Sh=L//K2 print(Sh*K)