import sys sys.set_int_max_str_digits(0) N, K = map(int, input().split()) S = input() stack = [] for i, s in enumerate(S, 1): if stack and stack[-1][0] == '(' and s == ')': # stack[-1][1] と i がペア x, y = stack[-1][1], i if x == K: exit(print(y)) if y == K: exit(print(x)) stack.pop() else: stack.append((s, i))