a,b = map(int,input().split()) c = a//(2*b) if a % (2*b) == 0 : ans = (c-1)*b else : ans = c*b print(ans)