N, M = map(int, input().split()) S = input() d = c = a = 1 if S[M-1] == ")" : d = -1 while 1: if S[M-1 + c * d] == S[M-1]: a += 1 else: a -= 1 if a == 0 : break c += 1 print(M + c * d)