N,K = map(int,raw_input().split(' ')) S = raw_input() s = [] i = 0 flag = False while not flag: while i < len(S) and S[i] == '(': s.append(i+1) i += 1 while i < len(S) and S[i] == ')': p = s.pop() if p == K or (i+1) == K: flag = True print i+1 if p == K else p break i += 1