def main(): N,S=(int(x) for x in input().split()) l = input() list = [] for i in l: list.append(i) for i in range(N): i = 0 if list[i] == "(": for j in range(N-(i+1)): if list[i+j+1] == "(" or list[i+j+1] == "0": continue elif list[i+j+1] == ")": list[i+j+1] = "0" for k in range(i+j+1,-1,-1): if list[k] == "(": m = k list[k] = "0" break if m+1 == S: print(i+j+2) break elif i+j+2 == S: print(m+1) break else: break if __name__ == "__main__": main()