import strutils, sequtils, algorithm, future, sets proc readint(f: File): int = f.readline.parseInt proc readints(f: File): seq[int] = f.readline.split.map(parseInt) var nk = stdin.readints n = nk[0] k = nk[1] - 1 s = stdin.readline m = newSeq[int](s.len) c = 0 for i in 0..s.high: m[i] = c if s[i] == '(': c += 1 else: c -= 1 m[i] = c if s[k] == '(': for i in countup(k+1,s.high): if m[k] == m[i]: echo i+1 break else: for i in countdown(k-1,0): if m[k] == m[i]: echo i+1 break