N,M = map(int,input().split()) P = 998244353 C = N + 50 fact = [1] * C fact_inv = [1] * C for i in range(2,C): fact[i] = fact[i-1] * i % P fact_inv[-1] = pow(fact[-1],P-2,P) for i in range(C-2,1,-1): fact_inv[i] = fact_inv[i + 1] * (i + 1) % P K = 31 dp = [0] * K same = 0 now = 0 for i in range(29,-1,-1): nx = [0] * K mask = 1 << i same |= M & mask for k in range(K): nx[k] = dp[k] for k in range(K-1): nx[k+1] += dp[k] if M & mask: nx[now] += 1 now += 1 for k in range(K): nx[k] %= P dp = nx dp[now] += 1 comb = [[0] * K for _ in range(K)] for n in range(K): for k in range(K): comb[n][k] = fact[n] * fact_inv[k] * fact_inv[n-k] % P def calc(k): dp = [0] * (k + 1) dp[0] = 1 for _ in range(N): nx = [0] * (k + 1) for i in range(k + 1): for j in range(k + 1 - i): nx[i + j] += dp[i] * comb[k-i][j] nx[i+j] %= P dp = nx return dp[-1] ans = 0 for k in range(K): ans += dp[k] * calc(k) % P ans %= P print(ans)