# coding:utf-8 n, k = map(int, input().split()) s = str(input()) a = 0 b = 0 c = 0 if k == len(s): print(1) elif s[k-1] == '(': while True: if b - a == 1: print(k + c) break c += 1 if s[k+c-1] == '(': a += 1 else: b += 1 elif s[k-1] == ')': while True: if a - b == 1: print(k + c) break c += 1 if s[-k-c+1] == ')': b += 1 else: a += 1