import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop; void main() { auto s = readln.split.map!(to!int); auto N = s[0]; auto X = s[1] + 1; int[] factors; for (int i = 2; i * i <= X; i++) { if (X % i == 0) factors ~= (i * i == X ? [i] : [i, X / i]); } int[int[3]] mem; int dfs(int x, int k, int d) { if (d == N) return x == 1; int[3] key = [x, k, d]; if (key in mem) return mem[key]; int ans = 0; foreach (i; k..factors.length.to!int) { if (x % factors[i] == 0) ans += dfs(x / factors[i], i, d+1); } return mem[key] = ans; } dfs(X, 0, 0).writeln; }