var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var N = Number(lines[0].split(" ")[0]);
    var M = Number(lines[0].split(" ")[1]);
    var cnt = 1;

    for (var i = 2; i <= Math.sqrt(M); i++) {
        if (M % i === 0) { M = M / i; cnt++; i--; }
    }

    var pattarn = c(cnt - 1, N - 1);

    console.log(pattarn * factorial(N));
});

function c(n, k) {
    return (p(n, k) / p(k, k));
}
function p(n, k) {
    var result = 1;

    for (var i = n; k < i; i--) { result *= n; }
    return (result);
}

function factorial(n) {
    var result = 1;
    for (var i = n; 0 < i; i--) {
        result *= i;
    }
    return (result);
}
