Problem:
Score : 400 points

Problem Statement

You are given positive integers N and M.

How many sequences a of length N consisting of positive integers satisfy a_1 \times a_2 \times ... \times a_N = M? Find the count modulo 10^9+7.

Here, two sequences a' and a'' are considered different when there exists some i such that a_i' \neq a_i''.

Constraints

All values in input are integers.

1 \leq N \leq 10^5

1 \leq M \leq 10^9

Input

Input is given from Standard Input in the following format:

N M

Output

Print the number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.

Sample Input 1

2 6

Sample Output 1

4

Four sequences satisfy the condition: \{a_1, a_2\} = \{1, 6\}, \{2, 3\}, \{3, 2\} and \{6, 1\}.

Sample Input 2

3 12

Sample Output 2

18

Sample Input 3

100000 1000000000

Sample Output 3

957870001

Solution in JavaScript (node.js v5.12) (judge verdict: Accepted)

var ModUtils = function(mod){
	this.mod = mod;
}
ModUtils.prototype.inv = function(n) {
  function euclidean(a,b){
  	if(a == 1 && b == 0)return {x:1,y:0};
  	var ans = euclidean(b,a%b);
    var x = ans.y;
    var y = ans.x - x * Math.floor(a/b);
    return {x:x,y:y};
  }
  var c = euclidean(this.mod,n).y;
  while(c < 0){c += this.mod}
  return c;
};
ModUtils.prototype.product = function() {
  var initVal = 1;
  var len = arguments.length;
  for(var i = 0; i < len;i++){
  	var elem = arguments[i];
  	initVal = this.times(initVal,elem);
  }
  return initVal;
};
ModUtils.prototype.times = function(hoge,fuga) {
	if(hoge*fuga > Number.MAX_SAFE_INTEGER){
    var b = hoge % this.mod;
    var d = fuga % this.mod;
    var min = Math.min(b,d);
    var max = Math.max(b,d);
    
    var hogehoge = 0;
    if(min % 2){
    	hogehoge += max;
      min -= 1;
    }
    hogehoge += this.times(max,min/2);
    hogehoge %= this.mod;
    hogehoge += this.times(max,min/2);
    hogehoge %= this.mod;
    return hogehoge;
  }else{
  	return (hoge*fuga) % this.mod;
  }
};
ModUtils.prototype.combination = function(n,k){
  k = Math.min(k,n-k);
  var a = this.product(...Array.from({length:k},(v,k)=>n-k));
  var b = this.product(...Array.from({length:k},(v,k)=>k+1));
  var bInv = this.inv(b);
  return this.product(a,bInv);
}

function Main(input){
	var N = input.split(" ")[0];
	var M = input.split(" ")[1];

	N = ~~N;
  M = ~~M;
	var primeList = [2,3];
  
  input = M;
  
  var inputRoot = Math.floor(Math.sqrt(input));
  
  for(var i = primeList[primeList.length-1] + 1; i <= inputRoot;i++){
  	if(primeList.find(a=>i%a==0)===undefined)primeList.push(i);
  } 
  
  var primeFact = {};
  
  for(var elem of primeList){
  	while(input%elem == 0){
    	input /= elem;
      primeFact[elem] = (primeFact[elem] || 0)+1;
    }
  }
  
  if(input != 1){
  	primeFact[input] = (primeFact[input] || 0)+1;
  }
  
  var mod = 1000000007;
  var mu = new ModUtils(mod);
  
  var arr = [];
  for(var key in primeFact){
  	var elem = primeFact[key];
  	arr.push(mu.combination(elem+N-1,elem));
  }
  return mu.product(...arr);
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
2 35
`);