import strutils, sequtils var n, k: int (n, k) = map(split readLine stdin, parseInt) var S = readLine stdin var T = newSeq[int](n) var i, j = 0 var flg = false var m: int var mark: char while not flg: while S[i] != ')' or T[i] != 0: i += 1 j += 1 T[i] = j flg = if i == n - 1: true else: false while T[i] > 0: i -= 1 T[i] = j for i in 0 ..< n: if i + 1 == k: m = T[i] mark = S[i] for i in 0 ..< n: if T[i] == m and S[i] != mark: echo i + 1