#! ruby # yukicoder My Practice # author: Leonardone @ NEETSDKASU N, K = gets.chomp.split.map(&:to_i) S = gets.chomp stk = [] S.size.times do |i| if S[i] == '(' stk.push i else j = stk.pop if K == j + 1 puts (i + 1) exit elsif K == i + 1 puts (j + 1) exit end end end