L, K =[int(i) for i in input().split()] n = L//(2*K) if 2*K*n == L: n = n-1 print(K*n)