#yukicoder No.22 括弧の対応 N, K = map(int, input().split()) S = input() d = [] cnt = 0 for i in range(N): if S[i] == "(": cnt += 1 else: cnt -= 1 d.append(cnt) i = K - 1 if S[i] == ")": while True: i -= 1 if d[i] == d[K - 1] + 1 and S[i] == "(": print(i + 1) break else: while True: i += 1 if d[i] == d[K - 1] - 1 and S[i] == ")": print(i + 1) break