#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL << 60;
const long long MOD = 998244353;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
struct mint {
  long long x;
  mint(long long x = 0) : x((x % MOD + MOD) % MOD) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  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 t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
int main(void) {
  long long N, S;
  cin >> N >> S;
  vector<long long> A(N);
  for (int i = (0); i < (N); ++i) cin >> A[i];
  mint ans(0);
  mint dp[N + 1][S + 1];
  dp[0][0] = 1;
  for (int i = (0); i < (N); ++i)
    for (int j = (0); j < (S); ++j) {
      dp[i + 1][j + 1] += dp[i][j + 1];
      if (j + 1 - A[i] >= 0) dp[i + 1][j + 1] += dp[i + 1][j + 1 - A[i]];
    }
  for (int L = (N + 1) - 1; L >= (1); --L) {
    long long now = S;
    for (int R = (L + 1) - 1; R >= (1); --R) {
      ans += dp[L][S] - dp[R - 1][now] - dp[R - 1][now - A[L - 1]];
      now -= A[L - 1];
    }
  }
  cout << ans.x << "\n";
  return 0;
}
