#include <bits/stdc++.h>
template <class T>
bool umin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool umax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
using namespace std;
int main(int argc, char **argv) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  int N, S;
  cin >> N >> S;
  vector<int> A(N);
  for (int i = 0; i < (int)(N); ++i) cin >> A[i];
  const int Mod = 998244353;
  vector<vector<int> > d(N, vector<int>(S + 1, 0));
  int res = 0;
  for (int i = 0; i < (int)(N); ++i) {
    d[i][0] = 1;
  }
  for (int len = 0; len < (int)(N); ++len) {
    for (int i = 0; i < (int)(N - len); ++i) {
      int a = A[i + len];
      for (int j = (int)(S + 1 - a) - 1; j >= 0; --j) {
        d[i][j + a] = (d[i][j + a] + d[i][j]);
        if (d[i][j + a] >= Mod) d[i][j + a] -= Mod;
      }
      res += d[i][S];
      if (res >= Mod) res -= Mod;
    }
  }
  cout << res << endl;
  return 0;
}
