use std::cmp::min; const DIVISOR: u64 = 998244353; fn power(base: u64, p: u64) -> u64 { if p == 0 { return 1; } if p == 1 { return base; } let temp = power(base, p/2); temp * temp % DIVISOR * base % DIVISOR } fn comb(n: u64, r: u64) -> u64 { if r == 0 || r == n { return 1u64; } let mut nums = vec![1u64; r as usize + 1usize]; let mut denoms = vec![1u64; r as usize + 1usize]; let mut temp = 1u64; for i in 1..=r { nums[i as usize] = nums[i as usize - 1usize] * (n + 1 - i) % DIVISOR; temp *= i; temp %= DIVISOR; denoms[i as usize] = power(temp, DIVISOR-2); } nums[r as usize] * denoms[r as usize] % DIVISOR } 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 m = nm[1]; let mut result: u64 = 0; for i in 0..=m/n { let base = m - i * n + i; result += comb(base, min(base - i, i)); result %= DIVISOR; } println!("{}", result); }