## https://yukicoder.me/problems/no/2576 MOD = 998244353 import math def calc_gcd(A, B): """ 正の整数A, Bの最大公約数を計算する """ a = max(A, B) b = min(A, B) while a % b > 0: c = a % b a = b b = c return b def main(): N, M = map(int, input().split()) # Mの約数列挙 sqrt_m = int(math.sqrt(M)) divisors = [] for p in range(1, sqrt_m + 1): if M % p == 0: q = M // p divisors.append(p) if q != p: divisors.append(q) divisors.sort() lcm_map = {} for d1 in divisors: for d2 in divisors: gcd = calc_gcd(d1, d2) lcm_map[(d1, d2)] = (d1 // gcd) * d2 def solve(map1, map2, divisors): new_map = {} for d1 in divisors: for d2 in divisors: lcm = lcm_map[(d1, d2)] if M % lcm != 0: break if d1 not in map1 or d2 not in map2: continue if lcm not in new_map: new_map[lcm] = 0 new_map[lcm] += (map1[d1] * map2[d2]) % MOD new_map[lcm] %= MOD return new_map answer_map = {1:1} base_map = {d: 1 for d in divisors} while N > 0: if N % 2 == 1: answer_map = solve(answer_map, base_map, divisors) N //= 2 base_map = solve(base_map, base_map, divisors) print(answer_map[M]) if __name__ == "__main__": main()