N,K=map(int,input().split()) S=list(input()) A,Q={},[] for i in range(N): j=i+1 if S[i]==')':x=Q.pop();A[x],A[j]=j,x else:Q.append(j) print(A[K])