#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 998244353;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
  ll N, S;
  cin >> N >> S;
  vector<ll> A(N);
  for (ll i = 0; i < (N); ++i) cin >> A[i];
  vector<ll> coef(S + 5, 0);
  ll ans = 0;
  for (ll i = 0; i < (N); ++i) {
    vector<ll> now(S + 5);
    ++now[0];
    ++now[A[i]];
    for (ll j = 0; j < (S + 5); ++j) {
      now[j] += coef[j];
      if (j + A[i] <= S) now[j + A[i]] += coef[j];
      now[j] %= MOD;
    }
    coef = now;
    ans += coef[S], ans %= MOD;
  }
  cout << (ans) << '\n';
  return 0;
}
