using System; namespace No022_括弧の対応 { class Program { static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int n = int.Parse(input[0]); int k = int.Parse(input[1]); string s = Console.ReadLine(); int count, level = 0; count = k - 1; if (s[count] == '(') { do { count++; if (s[count] == '(') level++; else level--; } while (level > 0); } else { do { count--; if (s[count] == ')') level++; else level--; } while (level > 0); } Console.WriteLine(count.ToString()); } } }