#!/usr/bin/python # -*- coding: utf-8 -*- ### INPUT ### N , h = map(int, raw_input().split()) arrays = raw_input() num = [] ans = {} for i,array in enumerate(arrays): if array == "(": num.append(i+1) elif array == ")": tmp = num.pop(-1) ans.update({i+1 : tmp}) ans.update({tmp : i+1}) if h in ans: print ans[h] exit()