#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
const ll MOD = 998244353;
ll add(ll a, ll b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}
ll sub(ll a, ll b) {
  a -= b;
  if (a < 0) a += MOD;
  return a;
}
ll mul(ll a, ll b) { return (ll)a * b % MOD; }
const ll MAXN = 3010;
ll n, s;
ll a[MAXN];
ll pows[MAXN];
ll dp[MAXN];
void solve() {
  cin >> n >> s;
  for (ll i = 1; i <= n; i++) cin >> a[i];
  ll ans = 0;
  for (ll i = 0; i < MAXN; i++) dp[i] = 0;
  for (ll i = 1; i <= n; i++) {
    for (ll w = s + 1; w >= 1; w--) {
      ll nxt = w + a[i];
      if (nxt > s + 1) nxt = s + 1;
      dp[nxt] += dp[w];
    }
    ll nxt = a[i];
    if (nxt > s + 1) nxt = s + 1;
    dp[nxt] += i;
    ans = add(ans, dp[s]);
  }
  cout << ans << endl;
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout.precision(20);
  ll t;
  t = 1;
  while (t--) solve();
  return 0;
}
