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