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.pop.product(*a).map{|e|e.reduce :*}.sort[0..-1].reverse m={} f=->x,n,d,a{x==1&&n<1?1:m[[x,n,d]]||=->{r=0;(d...a.size).each{|i|x%a[i]>0||r+=f[x/a[i],n-1,i,a]};r}[]} p f[x,n,0,b]