#include <bits/stdc++.h>
using namespace std;
template <class L, class R>
ostream& operator<<(ostream& cout, pair<L, R> P) {
  return cout << '(' << P.first << ',' << P.second << ')';
}
template <class T>
ostream& operator<<(ostream& cout, vector<T> V) {
  cout << "[ ";
  for (auto v : V) cout << v << ' ';
  return cout << ']';
}
long long f[3001][3001];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (long long i = 0; i < 3001; ++i) {
    f[0][i] = 0;
  }
  long long n, s;
  cin >> n >> s;
  vector<long long> inp(n);
  for (long long i = 0; i < n; ++i) {
    cin >> inp[i];
  }
  if (s >= inp[0]) {
    f[0][inp[0]] = 1;
  }
  vector<long long> prefix(s + 1, 0);
  prefix[inp[0]] = 1;
  long long ans = 0;
  for (long long ix = 1; ix < n; ++ix) {
    for (long long sum = s; sum > inp[ix]; --sum) {
      f[ix][sum] = prefix[sum - inp[ix]];
      f[ix][sum] %= 998244353;
      prefix[sum] += f[ix][sum];
      prefix[sum] %= 998244353;
    }
    f[ix][inp[ix]] = ix + 1;
    prefix[inp[ix]] += (ix + 1);
    prefix[inp[ix]] %= 998244353;
    ans += (f[ix][s] * (n - ix));
    ans %= 998244353;
  }
  cout << ans << "\n";
}
