from collections import defaultdict def compress(lst): B = [] D = dict() from copy import deepcopy vals = deepcopy(lst) vals = list(set(vals)) vals.sort() from bisect import bisect_left for i in range(len(lst)): ind = bisect_left(vals, lst[i]) B.append(ind) for i in range(len(B)): D[lst[i]] = B[i] return B, D def div(n): S = set() i = 1 while i * i <= n: if n % i == 0: S.add(i) S.add(n // i) i += 1 return sorted(list(S)) N, M = map(int, input().split()) mod = 10 ** 9 + 7 L = div(M) K = len(L) LB, LD = compress(L) lst = [[] for _ in range(K)] for k in L: for nk in L: if (M // k) % nk == 0: lst[LD[nk]].append(LD[k]) pre = [0] * K pre[LD[1]] = 1 for i in range(N): dp = [0] * K for j in range(K): c = pre[j] % mod for nk in lst[j]: dp[nk] += c pre, dp = dp, pre ans = sum(pre)%mod print(ans % mod)