using System; using System.Linq; using System.Collections.Generic; class Program { static void Main(string[] args) { string[] x = Console.ReadLine().Split(); string s = Console.ReadLine(); int n = int.Parse(x[0]); int k = int.Parse(x[1]); List lst = new List(); int[] ary = new int[n]; for (int i = 0; i < n; i++) { if (s[i] == '(') { lst.Add(i); } else { ary[lst[lst.Count - 1]] = i; ary[i] = lst[lst.Count - 1]; lst.RemoveAt(lst.Count - 1); } } Console.WriteLine(ary[k - 1] + 1); Console.Read(); } }