#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vector<T>>;
const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
ll dp[3005];
int main() {
  init();
  ll N, S;
  cin >> N >> S;
  vl A(N);
  for (ll i = 0; i < (N); i++) cin >> A[i];
  ll ans = 0;
  for (ll i = 0; i < (N); i++) {
    dp[0]++;
    for (ll j = (S + 1) - 1; j >= (1); j--) {
      if (j >= A[i]) (dp[j] += dp[j - A[i]]);
    }
    (ans += dp[S]) %= MOD;
  }
  cout << ans << endl;
}
