#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
constexpr long long INF = LLONG_MAX / 10;
constexpr double eps = 1e-9;
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return 1;
  }
  return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return 1;
  }
  return 0;
}
using namespace std;
inline long long gcd(long long a, long long b) {
  while (b) {
    long long c = a;
    a = b;
    b = c % b;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
bool isprime(long long n) {
  if (n == 1) return false;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
long long mypow(long long a, long long b) {
  if (!b) return 1;
  if (b & 1) return mypow(a, b - 1) * a;
  long long memo = mypow(a, b >> 1);
  return memo * memo;
}
template <unsigned long long modulo = 1000000007>
class modInt {
  long long value;

 public:
  modInt() : value(0) {}
  template <typename T>
  modInt(T value = 0) : value(value) {
    if (value < 0) value = -(long long)(-value % modulo) + modulo;
    this->value = value % modulo;
  }
  inline operator long long() const { return value; }
  inline modInt& operator+=(const modInt& x) {
    value += x.value;
    if (value >= modulo) value -= modulo;
    return *this;
  }
  inline modInt& operator++() {
    if (value == modulo - 1)
      value = 0;
    else
      value++;
    return *this;
  }
  inline modInt operator-() const { return modInt(0) -= *this; }
  inline modInt& operator-=(const modInt& x) {
    value -= x.value;
    if (value < 0) value += modulo;
    return *this;
  }
  inline modInt& operator--() {
    if (value == 0)
      value = modulo - 1;
    else
      value--;
    return *this;
  }
  inline modInt& operator*=(const modInt& x) {
    value = value * x.value % modulo;
    return *this;
  }
  inline modInt& operator/=(modInt rhs) {
    long long exp = modulo - 2;
    while (exp) {
      if (exp & 1) *this *= rhs;
      rhs *= rhs;
      exp >>= 1;
    }
    return *this;
  }
  template <typename T>
  modInt operator+(const T& rhs) const {
    return modInt(*this) += rhs;
  }
  template <typename T>
  modInt& operator+=(const T& rhs) {
    return operator+=(modInt(rhs));
  }
  template <typename T>
  modInt operator-(const T& rhs) const {
    return modInt(*this) -= rhs;
  }
  template <typename T>
  modInt& operator-=(const T& rhs) {
    return operator-=(modInt(rhs));
  }
  template <typename T>
  modInt operator*(const T& rhs) const {
    return modInt(*this) *= rhs;
  }
  template <typename T>
  modInt& operator*=(const T& rhs) {
    return operator*=(modInt(rhs));
  }
  template <typename T>
  modInt operator/(const T& rhs) const {
    return modInt(*this) /= rhs;
  }
  template <typename T>
  modInt& operator/=(const T& rhs) {
    return operator/=(modInt(rhs));
  }
};
long long n, s, a[3010];
modInt<998244353> dp[3010];
signed main() {
  cin >> n >> s;
  for (long long i = 0; i < (n); i++) cin >> a[i];
  long long ans = 0;
  for (long long i = 0; i < (n); i++) {
    fill(dp, dp + s + 1, 0);
    dp[a[i]] = 1;
    if (a[i] == s) ans += (i + 1) * (n - i);
    for (long long j = i + 1; j < n; j++) {
      for (long long k = s - a[j]; k >= 0; k--) dp[k + a[j]] += dp[k];
      ans += dp[s] * (i + 1) * (n - j);
      dp[s] = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
