require'prime' n,x=gets.split.map &:to_i a=(x+1).prime_division.map{|k,v|(0..v).map{|i|k**i}} b=a.shift.product(*a).map{|e|e.reduce(:*)}.sort[1..-1] m={} f=->x,n,d,a{ return 1 if x==1&&n==0 return 0 if x==1||n==0 m[[x,n,d]]||=lambda{ r=0 (d...a.size).each{|i|r+=f.(x/a[i],n-1,i,a) if x%a[i]==0} r }.() } p f.(x+1,n,0,b)