n,m = map(int,input().split()) mod = 998244353 ### for bigger prime N = 2*n+5 fact = [1]*N finv = [1]*N for i in range(2,N): fact[i] = (fact[i-1]*i)%mod finv[-1] = pow(fact[-1],mod-2,mod) for i in range(1,N)[::-1]: finv[i-1] = (finv[i]*i)%mod def nCr(n,r): if r > n: return 0 else: return fact[n]*finv[r]%mod*finv[n-r]%mod def nPr(n,r,mod): if r > n: return 0 else: return fact[n]*finv[n-r]%mod am = abs(m) s = set() for i in range(1,int(am**0.5)+1): if m%i: continue s.add((i,m//i)) s.add((m//i,i)) s.add((-i,-m//i)) s.add((-m//i,-i)) if m == 0: for i in range(-n//2,n//2+1): x = i y = i s.add((x+y,x-y)) x = i y = -i s.add((x+y,x-y)) ans = 0 for x,y in s: if (n-abs(x))%2 or abs(x) > n: continue if (n-abs(y))%2 or abs(y) > n: continue ans += nCr(n,(n-abs(x))//2) * nCr(n,(n-abs(y))//2) % mod ans %= mod inv4 = pow(4,mod-2,mod) ans *= pow(inv4,n,mod) ans %= mod print(ans)