fn main() { let mut nm = String::new(); std::io::stdin().read_line(&mut nm).ok(); let nm: Vec = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nm[0]; let k = nm[1]; let summary = n * (n+1) / 2; if k == summary { println!("0"); return; } let k = summary - k; let mut lidx = 1usize; let mut ridx = 1usize; let mut val = 1usize; while lidx <= n { while ridx < n && val < k { ridx += 1; val += ridx; } if val == k { println!("1"); return; } val -= lidx; lidx += 1; } println!("2"); }