N, M = map(int, input().split()) S = input() count = 0 if S[M-1] == "(": for i in range(M, N): if S[i] == ")" and count == 0: print (i+1) break elif S[i] ==")": count -= 1 else: count += 1 else: for i in range(M-2, -1, -1): print("count", count, "i", i, S[i]) if S[i] == "(" and count == 0: print (i+1) break elif S[i] =="(": count -= 1 else: count += 1