input_list = list(map(int,input().split())) n, k = input_list s = input() s_list = list(s) len_s = len(s_list) comb_list = [] checked = 0 res = None while checked != n: close_index = s_list.index(')') open_index = None for i in range(close_index): if s_list[i] == '(': open_index = i if open_index == k - 1: res = close_index + 1 break elif close_index == k - 1: res = open_index + 1 break s_list[close_index] = 'x' s_list[open_index] = 'x' checked += 2 print(res)