alias LL = Int64 macro chmin(x, y); {{x}} = {{y}} if {{x}} > {{y}}; end macro chmax(x, y); {{x}} = {{y}} if {{x}} < {{y}}; end macro yn(x); {{x}} ? "Yes" : "No"; end # 約数列挙 def divsors(n : Int64) res = Set(Int64).new i = 1i64 while i * i <= n if n % i == 0 res << i res << (n // i) end i += 1 end return res end # ---------------------------------------------------- :) n, m = read_line.split.map(&.to_i64) mod = 10**9+7 div = divsors(m) dp = Array.new(n){Hash(LL, LL).new(0)} sum = Hash(LL, Array(LL)).new div.each do |i| dp[0][i] = 1 div.each do |j| if (1i128*i*j) % m == 0 sum[i] ||= [] of Int64 sum[i] << j end end end 1.upto(n-1) do |i| div.each do |j| sum[j].each do |k| dp[i][j] += dp[i-1][k] dp[i][j] %= mod end end end puts dp[n-1].values.sum(&.% mod) % mod