#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  x = 0;
  int f = 1;
  char k = getchar();
  for (; k > '9' || k < '0'; k = getchar())
    if (k == '-') f = -1;
  for (; k >= '0' && k <= '9'; k = getchar()) x = x * 10 + k - '0';
  x *= f;
}
template <class T>
inline void _print(T x) {
  if (x > 9) _print(x / 10);
  putchar(x % 10 + '0');
}
template <class T>
inline void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  _print(x);
}
inline int qpow(int x, int m, int mod) {
  int res = 1, bas = x;
  while (m) {
    if (m & 1) res = (1ll * res * bas) % mod;
    bas = (1ll * bas * bas) % mod, m >>= 1;
  }
  return res;
}
const int N = 3e3 + 5, mod = 998244353;
inline int add(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }
inline int mul(int x, int y) { return 1ll * x * y % mod; }
inline void inc(int &x, int y) { x = add(x, y); }
int n, m, ans, val[N], dp[N];
int main() {
  read(n), read(m);
  for (register int i = 1; i <= n; ++i) read(val[i]);
  for (register int i = 1; i <= n; ++i) {
    for (register int j = 1; j <= m; ++j) dp[j] = 0;
    for (register int j = i; j <= n; ++j) {
      for (register int k = m; k >= val[j]; --k) inc(dp[k], dp[k - val[j]]);
      inc(dp[val[j]], 1), inc(ans, dp[m]);
    }
  }
  print(ans);
  return 0;
}
