# encoding: utf-8 a = gets.split(' ').map{|n| n.to_i}.to_a n = a[0] k = a[1] s = gets.chomp.split("") lr = s.at(k-1) if lr == ")" s = s.reverse k = n - k f = true else k -= 1 end i = 1 while k <= n do k += 1 if s.at(k) == lr i += 1 else i -= 1 if i == 0 if f puts n-k else puts k+1 end break end end end if k == n puts "no" end