import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.math.*; public class Main { public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); String[] str = br.readLine().split(" "); int n = Integer.parseInt(str[0]); int k = Integer.parseInt(str[1]); String a = br.readLine(); int[] f = new int[n/2]; int[] l = new int[n/2]; int cnt = 0; int pos = -1; for(int i = 0; i < n; i++){ char c = a.charAt(i); if(c=='('){ f[cnt]=i+1; if(i+1==k)pos = cnt; cnt++; }else{ cnt--; l[cnt]=i+1; if(i+1==k){ sb.append(f[cnt]); System.out.println(sb); return; } if(pos==cnt){ sb.append(l[cnt]); System.out.println(sb); return; } } } } }