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