import sequtils, strutils let nk = stdin.readLine.split.map parseInt n = nk[0] k = nk[1] s = readLine stdin var a = (1..n).toSeq b = s c = (-1).repeat n while b.len > 0: let i = b.find "()" j = i.succ c[a[i].pred] = a[j] c[a[j].pred] = a[i] a.delete i..j b.delete i, j echo c[k.pred]