import java.util.*; import java.io.*; class Aaf { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int K = scan.nextInt()-1; int ans = 0 , j = 0; char [] S = scan.next().toCharArray(); for(int i=0; i<=N; i++){ if(S[K]=='('){ if(S[K+i]=='('){ j=j+1; }else{ j=j-1; } }else{ if(S[K-i]=='('){ j=j+1; }else{ j=j-1; } } if(j==0){ ans=i; break; } } if(S[K]=='('){ ans=K+ans+1; }else{ ans=K-ans+1; } System.out.println(ans); } }