scan = string.gmatch(io.read(),"%d+") n = scan() - 0 k = scan() - 0 l = "(" r = ")" b = {} i = 1 for v in string.gmatch(io.read(),".") do if v == l then table.insert(b,i) elseif v == r then local pop = table.remove(b) if k == pop then print(i) break elseif k == i then print(pop) break end end i = i + 1 end