fn main() { let mut nk = String::new(); std::io::stdin().read_line(&mut nk).ok(); let nk: Vec = nk.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nk[0]; let k = nk[1]; if n == 0 && k > 0 { println!("INF"); return; } let ulimit = 1usize << (format!("{:b}", 100000).len() + 1); let mut result = 0usize; for y in 0..ulimit { if y & n != n { continue; } let lower = if y < k { 0 } else { y - k }; for x in lower..=y { if x & y == n { result += 1; } } } println!("{}", result); }