using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        Stack<int> stack = new Stack<int>();
        int[] n = Console.ReadLine().Split().Select(a => int.Parse(a)).ToArray();
        string s = Console.ReadLine();
        for(int i = 0; i < n[0]; i++)
        {
            if(s[i] == '(')
            {
                stack.Push(i + 1);
            }
            else
            {
                Tuple<int, int> temp = new Tuple<int, int>(stack.Pop(), i + 1);
                if(temp.Item1 == n[1])
                {
                    Console.WriteLine($"{temp.Item2}");
                    return;
                }
                if(temp.Item2 == n[1])
                {
                    Console.WriteLine($"{temp.Item1}");
                    return;
                }
            }
        }
    }
}