#include <bits/stdc++.h>
using namespace std;
template <class T>
inline istream& operator>>(istream& str, vector<T>& a) {
  for (auto& i : a) str >> i;
  return str;
}
long long mod = 998244353;
long long add(long long x, long long y) {
  return ((x % mod) + (y % mod)) % mod;
}
signed main() {
  long long n, s;
  cin >> n >> s;
  long long a[n + 1];
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long dd[n + 1][s + 1];
  dd[0][0] = 1;
  memset(dd, 0, sizeof dd);
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    dd[i][a[i]] = i;
    for (long long sum = 0; sum <= s; sum++) {
      dd[i][sum] = add(dd[i][sum], dd[i - 1][sum]);
      if (sum >= a[i]) dd[i][sum] = add(dd[i][sum], dd[i - 1][sum - a[i]]);
    }
    ans = add(ans, dd[i][s]);
  }
  cout << ans;
}
