module main;

import std;

void main()
{
	// 入力
	int N, K;
	readln.chomp.formattedRead("%d %d", N, K);
	auto S = readln.chomp;
	// 答えの計算と出力
	int[][] groups;
	auto stack = DList!int();
	foreach (e; S.enumerate(1)) {
		int i = e.index;
		auto c = e.value;
		if (c == '(') {
			stack.insertBack(i);
		} else {
			groups ~= [i, stack.back];
			stack.removeBack;
		}
	}
	// Kが含まれる組を見つける
	auto ans = groups.find!(a => !a.find(K).empty);
	// その組のKでない数を表示する
	writeln(ans.front.find!(a => a != K).front);
}