import java.io.*; class Yuki22 { public static void main(String[] args) throws IOException { InputStreamReader is = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(is); String s = br.readLine(); int n,k; String[] sa = s.split(" "); n = Integer.parseInt(sa[0]); k = Integer.parseInt(sa[1]); String s2 = br.readLine(); int x; x=s2.length()+1; if(s2.charAt(k-1)=='('){ int a; a=1; for(int i=k; i=0; --i){ if(s2.charAt(i)==')'){ a++; } else { a--; if(a==0){ x=i; break; } } } } x+=1; System.out.println(x); } }