# coding:utf-8 n, k = map(int, input().split()) s = str(input()) a = 0 b = 0 c = 0 if k == len(s): print(1) elif s[k-1] == '(': while True: if b - a == 1: print(k+c) break c += 1 if s[k+c-1] == '(': a += 1 # '('を1つ増やす else: b += 1 # ')'を1つ増やす elif s[k-1] == ')': while True: if b - a == 1: print(len(s[-k:-1])-c+1) break c += 1 if s[k-c+1] == '(': a += 1 # ')'を1つ増やす else: b += 1 # '('を1つ増やす