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