#include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; const ll modc=998244353, MAX=1000000; vector f, finv; ll inv(ll x){ ll ans = 1, e = modc-2; x %= modc; while (e > 0){ if ((e & 1LL)) ans = (ans * x) % modc; e = e >> 1LL; x = (x*x) % modc; } return ans; } void init(){ f.resize(MAX+1); finv.resize(MAX+1); f[0] = 1; for (int i=1; i<=MAX; i++) f[i] = (f[i-1]*i) % modc; finv[MAX] = inv(f[MAX]); for (int i=MAX-1; i>=0; i--) finv[i] = (finv[i+1] * (i+1)) % modc; } ll C(ll n, ll k){ if (n < k || k < 0) return 0; return (((f[n] * finv[k]) % modc) * finv[n-k]) % modc; } int main(){ init(); ll N, M, ans=0; cin >> N >> M; vector A(N); for (int i=0; i> A[i]; vector> dp(N+1, vector(M+1, 1e18)); dp[0][0] = 0; for (int i=1; i<=N; i++){ for (int j=0; j<=M; j++){ dp[i][j] = min(dp[i][j], dp[i-1][j]); if (j-A[i-1]>=0) dp[i][j] = min(dp[i][j], dp[i][j-A[i-1]]+1); } } for (int i=0; i<=M; i++){ ans += C(M-dp[N][i], i-dp[N][i]); ans %= modc; } cout << ans << endl; return 0; }