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