import sys if sys.platform =='ios': import clipboard a=clipboard.get() a = a.split('\n') text = '\n'.join(a) with open('input_file.txt','w') as f: f.write(text) sys.stdin = open('input_file.txt') from collections import deque n,k = map(int,input().split()) s = input() q = deque([]) for i,x in enumerate(s): if x == "(": q.append(i+1) else: y = q.pop() if i+1 == k: print(y) elif y == k: print(i+1) exit()