n , k = map(int,input().split()) s = list(input()) flag = True while flag: for i in range(n): if s[i] == "(": for j in range(1 , n): if s[i + j] == "(" or i + j > n - 1: break if s[i + j] == ")": s[i],s[i + j] = 0,0 if i + 1 == k: ans = i + j + 1 flag = False if i + j + 1 == k: ans = i + 1 flag = False break print(ans)