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