import sequtils, strutils let n: seq[int] = stdin.readline.split.map(parseInt) s: string = stdin.readline var cnt: int = 1 ans: int if s[n[1]-1] == '(': for i in countup(n[1], n[0]-1): if s[i] == s[n[1]-1]: cnt.inc else: cnt.dec if cnt == 0: ans = i + 1 break else: for i in countdown(n[1]-2, 0): if s[i] == s[n[1]-1]: cnt.inc else: cnt.dec if cnt == 0: ans = i + 1 break echo ans