#include #define MOD 1000000007 using namespace std; typedef pair P; typedef pair> PP; typedef long long LL; const double EPS = 1e-8; const int INF = 1e9; int dy[] = {0,1,0,-1}; int dx[] = {1,0,-1,0}; int main(void) { int N,K; cin >> N >> K; string s; cin >> s; K--; int cnt = 0; if(s[K] == '(') for(int i=K+1;i=0;i--){ if(s[i] == '(' && cnt == 0){ cout << i+1 << endl; exit(0); } if(s[i] == ')')cnt++; else cnt--; } return 0; } // command shift d duplicate // command ctrl up down // command D // command caps G → '' "" // vector> a(N,vector(M,-1)); //diff < (./a.out < input.txt) output.txt // sort(v.begin(),v.end(),greater());