scan = string.gmatch(io.read(),"%d+") n = scan() - 0 k = scan() - 0 s = {} io.read():gsub(".",function(c) table.insert(s,c) end) l = "(" r = ")" result = 0 b = {} for i = 1, n do if s[i] == l then table.insert(b,i) elseif s[i] == r then local pop = table.remove(b) if k == pop then result = i break elseif k == i then result = pop break end end end print(result)