import collections N,K = map(int,input().split()) S = input() D = collections.deque(list('xx')) NO = collections.deque() for i in range(N): D.append(S[i]) NO.append(i+1) if D[-2]=='(' and D[-1]==')': D.pop() D.pop() R = NO.pop() L = NO.pop() if R == K : print(L) if L == K : print(R)