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