#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
template <class T>
inline void chmax(T& a, const T& b) {
  if ((a) < (b)) (a) = (b);
}
template <class T>
inline void chmin(T& a, const T& b) {
  if ((a) > (b)) (a) = (b);
}
template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast {
  Fast() {
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
long long mod = 998244353;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    (x += a.x) %= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    (x += mod - a.x) %= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/=(const mint& rhs) {
    if (rhs.x == 0) throw runtime_error("mint zero division");
    return *this *= rhs.inv();
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
  mint pow(long long n) const {
    mint res(1), x(*this);
    if (n < 0) {
      n = -n;
      x = (*this).inv();
    }
    while (n) {
      if (n & 1) res *= x;
      x *= x;
      n >>= 1;
    }
    return res;
  }
  mint inv() const {
    if (x == 0) throw runtime_error("inv does not exist");
    return pow(mod - 2);
  }
  bool operator<(const mint& r) const { return x < r.x; }
  bool operator==(const mint& r) const { return x == r.x; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
signed main() {
  long long n;
  cin >> n;
  long long s;
  cin >> s;
  vector<long long> a(n);
  for (long long i = (long long)(0); i < (long long)(n); ++i) {
    cin >> a[i];
  }
  42;
  vector<vector<long long>> dp(s + 1, vector<long long>(n));
  if (a[0] <= s) dp[a[0]][0] = 1;
  mint ans = 0;
  for (long long i = (long long)(1); i < (long long)(n); ++i) {
    for (long long x = (long long)(0); x < (long long)(s); ++x) {
      dp[x][i] += dp[x][i - 1];
    }
    if (a[i] <= s) {
      dp[a[i]][i] += i + 1;
      if (a[i] == s) {
        ans += (i + 1) * (n - i);
      }
    }
    for (long long x = (long long)(1); x < (long long)(s); ++x) {
      if (x + a[i] <= s) dp[x + a[i]][i] += dp[x][i - 1];
      if (x + a[i] == s) {
        42;
        ans += dp[x][i - 1] * (n - i);
        42;
      }
    }
  }
  42;
  cout << ans << endl;
  return 0;
}
