N, K = [int(i) for i in input().strip().split(' ')] S = [[i, n] for n, i in enumerate(list(input().strip()))] print(S) p = 0 while True: if S[p][0] + S[p + 1][0] == '()': if K - 1 in [S[p][1], S[p + 1][1]]: print([S[p + 1][1], S[p][1]][[S[p][1], S[p + 1][1]].index(K - 1)] + 1) exit(0) del S[p:p+2] p -= 1 else: p += 1