using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;

namespace yukicoder
{
    class Program
    {
        static void Main()
        {
            int[] nums = Console.ReadLine().Split(' ').Select(n => int.Parse(n)).ToArray();
            int N = nums[0];
            int K = nums[1];
            string S = Console.ReadLine();
            int[] chk = new int[N];

            for (int i = 0; i < N; i++)
            {
                // 括弧の個数を管理する変数
                int kakko = 1;

                for (int j = i+1; j < N; j++)
                {
                    // すでに対応する数値が分かっている場合は処理をスキップ
                    if (chk[j] != 0)
                    {
                        break;
                    }

                    if (')'.Equals(S[j]))
                    {
                        kakko--;
                    }
                    else
                    {
                        kakko++;
                    }

                    if (kakko == 0)
                    {
                        chk[i] = j+1;
                        chk[j] = i+1;

                        break;
                    }
                }
            }

            Console.WriteLine(chk[K-1]);

        }
    }
}