class ModCombination attr_reader :fac, :inv, :finv, :mod MOD = 10 ** 9 + 7 def initialize(n, mod: MOD) @mod = mod @fac = [1, 1] @inv = [1, 1] @finv = [1, 1] (2..n).each do |i| @fac[i] = fac[i - 1] * i % mod @inv[i] = mod - inv[mod % i] * (mod / i) % mod @finv[i] = finv[i - 1] * inv[i] % mod end end def combination(n, k) return 0 if n < k return 0 if n < 0 || k < 0 fac[n] * (finv[k] * finv[n - k] % mod) % mod end end MOD = 998244353 N, M = gets.split.map(&:to_i) mc = ModCombination.new(M + 1, mod: MOD) ans = 0 if N == 1 puts 1 exit end 0.upto(M / N) do |i| n = M - N * i + i ans += mc.combination(n, i) ans %= MOD end puts ans