l, k = map(int, input().split()) l -= 1 print(l//(2*k)*k)