N,K = map(int, input().split()) S = [1 if i == '(' else -1 for i in input()] K -= 1 m = S[K] n = m while m != 0: K += n m += S[K] print(K+1)