                                                                                                            tomaz1502@Pocus
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define forn(i,x,y) for(int i = int(x); i<int(y); i++)
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define all(V) V.begin(), V.end()
#define on(x, b) (x & (1LL << b))
#define trav(x, v) for(auto &x : v)

#define f first
#define s second

const int N = 3010;
const int mod = 998244353;
vector<int> a;
int n;
ll dp[N][N][2];

ll solve(int L, int S, bool started) {

    if(S == 0) return n - L + 1;
    if(S < 0) return 0;
    if(L >= n) return 0;
    ll &ans = dp[L][S][started];
    if (ans != -1) return ans;

    int x = a[L];
    if(!started) return ans = (solve(L + 1, S, true) + solve(L + 1, S, false)) % mod;
    else {
        return ans = (solve(L + 1, S - x, true) + solve(L + 1, S, true)) % mod;
    }
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL);

    int s; cin >> n >> s;
    a.resize(n); trav(i, a) cin >> i;
    memset(dp, -1, sizeof dp);

    cout << solve(0, s, true) + solve(0, s, false) << '\n';

    return 0;
}

/* don't forget to check:
   int overflow
   min/max cases (n = 1)
   printing index of sorted array
   limits for ans (start with inf)
   s = 'x' + s is linear! dont use it!
 */