import std.stdio, std.string, std.conv ,std.array, std.algorithm, std.range ,std.math; void main(){ auto buf = readln().strip().split().map!(to!int)(); immutable K = buf[1] - 1; auto S = readln().strip().to!string; int co = 0; if(S[K] == '(') { foreach(ulong i; K .. S.length) { if(S[i] == '(') ++ co; else -- co; if(co == 0) { writeln(i+1); break; } } } else { foreach_reverse(ulong i; 0 .. K+1) { if(S[i] == ')') ++ co; else -- co; if(co == 0) { writeln(i+1); break; } } } }