n, k = map(int, input().split()) s = list(input()) close_index = 0 open_index = len(s) - 1 is_find = False while close_index < len(s): if s[close_index] == ')': s[close_index] = 'checked' open_index = close_index while open_index >= 0: if s[open_index] == '(': s[open_index] = 'checked' if close_index + 1 == k: print(open_index + 1) is_find = True break elif open_index + 1 == k: print(close_index + 1) is_find = True break break else: open_index -= 1 if is_find: break close_index += 1