#include #include #include using namespace std; using ll = long long; constexpr int mod = 998244353; int main() { int N,L; cin>>N>>L; vector A(N); for(int i=0; i>A[i]; vector> dp(N+1, vector(N+1)); dp[1][0] = 1; for(int i=2; i<=N; i++){ for(int j=0; j<=N; j++){ if (j == 0){ dp[i][j] = (dp[i-1][j]+1 < mod ? dp[i-1][j]+1 : 0); }else{ dp[i][j] = dp[i-1][j] + dp[i-1][j-1]; if (dp[i][j] >= mod) dp[i][j] -= mod; } } } vector ans(N); ans[0]++; ans[N-1]++; for(int i=0; i= L-A[i+1]) ans[i]++; else ans[i+1]++; } int j = N; for(int i=0; i 0 && A[j-1] >= L-A[i]) j--; for(int k=i+1, l=0; k= mod) ans[k] -= mod; } for(int k=i, l=0; k= mod) ans[k] -= mod; } for(int k=i, l=0; k