import sys import math from math import sin, cos, tan from functools import reduce from collections import deque import heapq sys.setrecursionlimit(1000000) intm1 = lambda x:int(x)-1 N, K = map(int,input().split()) K -= 1 S = input() cnt = 1 if S[K] == '(' else -1 for i in range(K + 1, N, 1) if S[K] == '(' else range(K - 1, -1, -1): cnt += 1 if S[i] == '(' else -1 if cnt == 0: print(i + 1) break