using System; using System.Collections; public class Program { public static void Main() { string[] input = Console.ReadLine().Split(' '); int k = int.Parse(input[1]); string s = Console.ReadLine(); Stack stack = new Stack(); for (int i = 0; i < s.Length; i++) { if (s[i].Equals('(')) { stack.Push(i); } else if (s[i].Equals(')')) { int index = (int)stack.Pop() + 1; if (i + 1 == k) { Console.WriteLine(index); } else if (index == k) { Console.WriteLine(i + 1); } } } } }