#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
//const ll MOD = (ll)1e9+7;
const ll MOD = (ll)998244353;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/
struct mint {
    long long x;
    mint(long long _x=0):x((_x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint modpow(long long t) const {
        if (!t) return 1;
        mint a = modpow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return modpow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
    friend std::ostream& operator<<(std::ostream& os, const mint& a){
        os << a.x;
        return os;
    }
};
mint dp[3030][3030][2];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll N, S;
    cin >> N >> S;
    vec<ll> A(N);
    rep(i,N)cin >> A[i];
    rep(i,N+1)rep(j,S+2)rep(k,2)dp[i][j][k] = 0;
    dp[0][0][0] = 1;
    rep(i,N)rep(j,S+1){
        ll tj = min(S+1, j + A[i]);
        // dp[i+1][j][0] += dp[i][j][0];
        // dp[i+1][j][1] += dp[i][j][1];
        // from 0 to 0
        {
            dp[i+1][j][0] += dp[i][j][0];
        }
        // from 0 to 1
        {
            dp[i+1][j][1] += dp[i][j][0];
            dp[i+1][tj][1] += dp[i][j][0];
        }
        // from 1 to 0
        {
            dp[i+1][j][0] += dp[i][j][1];
        }
        // from 1 to 1
        {
            dp[i+1][j][1] += dp[i][j][1];
            dp[i+1][tj][1] += dp[i][j][1];
        }
    }
    // rep(i,N+1){
    //     rep(j,S+1){
    //         cerr << dp[i][j][0] << " " << dp[i][j][1] << endl;
    //     }
    //     cerr << endl;
    // }
    mint ans = dp[N][S][0] + dp[N][S][1];
    cout << ans << endl;
}

Measured memory_bytes: 147104