use std::io::*; fn main() { let s = stdin(); let mut handle = s.lock(); let mut buf = String::new(); handle.read_line(&mut buf).ok(); let l: Vec = buf .trim() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect(); let k = (l[1] - 1) as usize; let l = b'('; buf.clear(); handle.read_line(&mut buf).ok(); let s = buf.trim().as_bytes(); let mut b = Vec::new(); for i in 0..s.len() { if s[i] == l { b.push(i); } else { let pop = b.pop().unwrap(); if k == pop { println!("{}", i + 1); return; } else if k == i { println!("{}", pop + 1); return; } } } }