import std.algorithm, std.conv, std.range, std.stdio, std.string; void main() { size_t[] rd = readln.split.to!(size_t[]); size_t n = rd[0], k = --rd[1]; string s = readln.chomp; size_t r = s[k].predSwitch('(', search(s[k..$]) + k, ')', k - search(s[0..k+1].retro)); writeln(++r); } size_t search(InputRange)(InputRange s) { int d = 0; foreach (i, c; s.enumerate) { d += c.predSwitch('(', +1, ')', -1); if (d == 0) return i; } return 0; }