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 n = l[0] as usize; let k = (l[1] - 1) as usize; let l = b'('; buf.clear(); handle.read_line(&mut buf).ok(); let mut v = Vec::with_capacity(n); let s = buf.trim().as_bytes().iter().enumerate().map(|e| { if e.1 == &l { v.push(e.0); None } else { let pop = v.pop().unwrap(); if k == pop { Some(e.0 + 1) } else if k == e.0 { Some(pop + 1) } else { None } } }).find(|x| x.is_some()); println!("{}",s.unwrap().unwrap()); }