N,K = map(int,input().split()) S = input() stack = [] l = [0] * N for i in range(N): if S[i] == '(': stack.append(i) else: j = stack.pop() l[j] = i l[i] = j print(l[K] + 1)