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