N,K = map(int, raw_input().split()) S = raw_input() K-=1 dif=1 if S[K] == ')': dif = -1 while dif != 0: K += dif/abs(dif) if S[K] == ')': dif -=1 else: dif +=1 print K+1