using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Yuki { class Program { static void Main(string[] args) { string[] a = Console.ReadLine().Split(); int n = int.Parse(a[0]); int k = int.Parse(a[1]); string s = Console.ReadLine(); bool mode; int cnt = 0; int i = k - 1; mode = s[k - 1].Equals('(') ? true : false; while (i >= 0 && i < n) { if (s[i].Equals(s[k - 1])) cnt++; else cnt--; if (cnt == 0) { break; } else { if (mode) i++; else i--; } } Console.WriteLine(i + 1); } } }