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 = 1; count = k - 1; if (n / 2 > k) { do { if (s[count] == '(') level++; else level--; count++; } while (level != 1); } else { do { if (s[count] == ')') level++; else level--; count--; } while (level != 1); count += 2; } Console.WriteLine(count.ToString()); } } }