using System; using System.Linq; class No22 { static void Main() { var num = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray(); var line = Console.ReadLine().ToCharArray(); var isAdd = line[num[1] - 1] == '(' ? true : false; var i = isAdd ? 0 : line.Length - 1 ; var shindo = 0; var myShindo = 0; while (true) { if (isAdd) { if (line[i] == '(') shindo++; else shindo--; if (i + 1 == num[1]) myShindo = shindo; if (shindo == myShindo && line[i] == ')') break; } else { if (line[i] == ')') shindo++; else shindo--; if (i + 1 == num[1]) myShindo = shindo; if (shindo == myShindo && line[i] == '(') break; } i = isAdd ? i + 1 : i - 1; } Console.WriteLine(i+1); } }