#include char kakko[10010]; int N,K; int main(void) { scanf ("%d %d",&N,&K); scanf ("%s",&kakko); int right,left; int vec; int answer; right=0; left=0; if (kakko[K-1] == '(') { for (int i = K-1; i < N; i++) { if ( kakko[i] == '(') right++ ; else left++ ; if (right==left) { answer=i+1; break; } } } else { for (int i = K-1; i >= 0; i--) { if ( kakko[i] == '(') right++ ; else left++ ; if (right==left) { answer=i+1; break; } } } printf("%d\n",answer); return 0; }