import std.stdio, std.conv, std.string, std.range, std.algorithm; void main() { auto input = readln.split.to!(int[]); auto N = input[0], K = input[1]; auto S = readln.strip; int count; size_t index; if (S[K - 1] == '(') { foreach (i, e; S[K - 1 .. $]) { count += (e == '(' ? 1 : -1); if (count == 0) { index = K + i; break; } } } else { foreach_reverse (i, e; S[0 .. K]) { count += (e == ')' ? 1 : -1); if (count == 0) { index = i + 1; break; } } } index.writeln; }