local mfl, mce = math.floor, math.ceil local mmi, mma = math.min, math.max n, k = io.read("*n", "*n") if k % 2 == 0 then if n % 2 == 0 then p1 = mfl(n / 2) p2 = k + 1 print(mmi(p1, p2)) else z = mfl(n / 2) if z <= mfl(k / 2) then print(n) else print(k + 1) end end else hk = mfl(k / 2) if n % 2 == 0 then p1 = mfl(n / 2) p2 = (hk + 1) * 2 print(mmi(p1, p2)) else hn = mfl(n / 2) p1 = mmi(hk + 1, hn) p2 = mmi(hk + 1, hn + 1) print(mmi(p1 + p2, n)) end end