from math import gcd def isp(n): if n == 2: return True if n == 1 or n % 2 == 0: return False m = n - 1;l = m & -m;s = l.bit_length() - 1;d = m // l for a in [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]: if a == n: continue x = pow(a, d, n);r = 0 if x == 1: continue while x != m: x = pow(x, 2, n);r += 1 if x == 1 or r == s: return False return True def findf(n): if n % 2 == 0: return 2 m = int(n ** 0.125) + 1 for c in range(1, n): def f(y): return (y * y + c) % n y = k = 0;g = q = r = 1 while g == 1: x = y while k < 3 * r // 4: y = f(y);k += 1 while k < r and g == 1: ys = y for _ in range(min(m, r - k)): y = f(y);q = q * abs(x - y) % n g = gcd(q, n);k += m k = r;r *= 2 if g == n: g = 1;y = ys while g == 1: y = f(y);g = gcd(abs(x - y), n) if g == n: continue if isp(g): return g elif isp(n // g): return n // g else: return findf(g) def factorize(n): res = [] while not isp(n) and n > 1: p = findf(n) e = 0 while n % p == 0:n //= p;e += 1 res.append((p, e)) if n > 1: res.append((n, 1)) res.sort() return res n, m = map(int, input().split()) ans = 1 for p, e in factorize(m): ans *= (e + 1) ** n - e ** n ans %= 998244353 print(ans)