d=[] f=->x,n,i{n<2?$.+=1:d[i..-1].map{|d|d**n>x ?break: x%d<1&&f[x/d,n-1,i];i+=1}} eval'N,X='+gets.split*?,+'+1' 2.upto(X**0.5){|i|d|=[i,X/i]if X%i<1} d=d.sort f[X,N,0]; p$.-1