import math import sys def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int, sys.stdin.readline().rstrip().split()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) n, k = MI() s = S() lq = [] d = {} for i in range(n): if s[i] == "(": lq.append(i+1) else: d[i+1] = lq.pop(-1) d[d[i+1]] = i+1 print(d[k])