# import sys; input = sys.stdin.buffer.readline # sys.setrecursionlimit(10**7) from collections import defaultdict con = 10 ** 9 + 7; INF = float("inf") def getlist(): return list(map(int, input().split())) #処理内容 def main(): N, K = getlist() cntSum = [0] * N S = input() cntSum[0] = 1 for i in range(1, N): if S[i] == "(": cntSum[i] = cntSum[i - 1] + 1 else: cntSum[i] = cntSum[i - 1] - 1 # print(cntSum) K -= 1 val = cntSum[K] # print(val) if S[K] == "(": for i in range(K + 1, N): if cntSum[i] == val - 1: print(i + 1) return else: for i in range(K): if cntSum[i] == val + 1: print(i + 1) return if __name__ == '__main__': main()