N, K = map(int, raw_input().split()) s = raw_input() dx = 1 #left to right if s[K-1] == ')': dx = -1 i = K-1 cnt = 1 #(num of same bracket as s[K-1]) - (not same) while cnt != 0: i += dx if s[i] == s[K-1]: cnt += 1 else: cnt -= 1 print i+1