#!/usr/bin/env python # -*- coding: utf-8 -*- def CheckAns(i, S): if S[i] is '(': return 1 else: return -1 def kakko(K, S): check = CheckAns(K - 1, S) i = K - 1 if check is 1: while check is not 0: i += 1 check += CheckAns(i, S) if check is -1: while check is not 0: i -= 1 check += CheckAns(i, S) return i + 1 def main(): N, K = map(int, input().split()) S = input() print(kakko(K, S)) if __name__ == '__main__': main()