using System; using System.Linq; class Program { static void Main(string[] args) { int[] NK = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); char[] S = Console.ReadLine().ToArray(); int kakko = 0; int idx = 0; if ('('.Equals(S[NK[1] - 1])) { for (idx = NK[1]; idx < S.Length; idx++) { if (kakko < 0) break; if ('('.Equals(S[idx])) kakko++; if (')'.Equals(S[idx])) kakko--; } } else { for (idx = NK[1] - 2; 0 < idx; idx--) { if (kakko < 0) break; if (')'.Equals(S[idx])) kakko++; if ('('.Equals(S[idx])) kakko--; } idx = +1; } Console.WriteLine(idx); } }