#coding: UTF-8 import sys from math import pi from collections import deque from functools import reduce ### defs ### ### main ### N,K = map(int,sys.stdin.readline().split()) S = sys.stdin.readline()[:N] sz = len(S) idx = [-1]*sz stack = [] for i in range(sz): if(S[i]=='('): stack.append(i) else: hd = stack[-1] idx[i] = hd idx[hd] = i stack.pop() print(idx[K-1]+1)