# -*- coding: utf-8 -*- from queue import LifoQueue def index(l): return l[0] def value(l): return l[1] def match(l, r): return value(l) == '(' and value(r) == ')' def reduce(ls, goal): ls = ls stack = LifoQueue() while len(ls) >= 2: hd, hd_, rest = ls[0], ls[1], ls[2:] if match(hd, hd_): if index(hd) == goal: return index(hd_) if index(hd_) == goal: return index(hd) ls = [stack.get()] + rest if not stack.empty() else rest else: stack.put(hd) ls = [hd_] + rest def solve(n, k, s): ls = [(i+1, c) for i, c in enumerate(s)] print(reduce(ls, k)) n, k = input().split() s = input() solve(int(n), int(k), s)