a, n = map(int,input().split()) sq = input() ls = sq[n:] c = 1 for N, i in enumerate(ls): if c > 0: if i == '(': c += 1 else: c -= 1 else: break print(str(n + N))