using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Magatro { static void Main() { string[] s = Console.ReadLine().Split(' '); int N = int.Parse(s[0]); int K = int.Parse(s[1])-1; string SS = Console.ReadLine(); List<int> L = new List<int>(); int[] c = new int[N]; for(int i = 0; i < N; i++) { if (SS[i] == '(') { L.Add(i); } else { c[L[L.Count-1]] = i; c[i] = L[L.Count - 1]; L.RemoveAt(L.Count - 1); } } Console.WriteLine(c[K]+1); } }