L,K=map(int,input().split()) a=L//K//2*K if L-a*2<=0: print(0) else: print(a)