def main(): N, K = [int(_) for _ in input().split()] K -= 1 S = input() depth_list = [] depth = 0 for letter in S: if letter == "(": depth += 1 depth_list.append(depth) else: depth_list.append(depth) depth -= 1 if S[K] == "(": i = K+1 while True: if depth_list[K] == depth_list[i]: print(i+1) return i += 1 else: i = K-1 while True: if depth_list[K] == depth_list[i]: print(i+1) return i -= 1 main()