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