#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout) {
  if (s != e) {
    os << *s;
    ++s;
  }
  while (s != e) {
    os << sep << *s;
    ++s;
  }
  return os;
}
ostream &YES(bool cond, string yes = "Yes", string no = "No",
             ostream &os = cout) {
  if (cond) {
    os << yes << endl;
  } else {
    os << no << endl;
  }
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << '(' << p.first << ", " << p.second << ')';
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << '[';
  JOUT((v).begin(), (v).end(), ", ", os) << ']';
  return os;
}
const long long INF = 1e18;
const long long MOD = 998244353;
struct mint {
  long long a;
  mint(long long a = 0) : a((a % MOD + MOD) % MOD) {}
  mint pow(long long y) {
    long long exp = y;
    mint res = 1;
    mint p = a;
    while (exp) {
      if (exp & 1) {
        res *= p;
      }
      exp >>= 1;
      p *= p;
    }
    return res;
  }
  mint pow(mint y) { return pow(y.a); }
  mint &operator+=(long long y) {
    *this = a + y;
    return *this;
  }
  mint &operator+=(mint y) {
    *this += y.a;
    return *this;
  }
  mint &operator-=(long long y) {
    *this = a - y;
    return *this;
  }
  mint &operator-=(mint y) {
    *this -= y.a;
    return *this;
  }
  mint &operator*=(long long y) {
    *this = a * y;
    return *this;
  }
  mint &operator*=(mint y) {
    *this *= y.a;
    return *this;
  }
  mint &operator/=(long long y) {
    *this *= mint(y).pow(MOD - 2);
    return *this;
  }
  mint &operator/=(const mint y) {
    *this /= y.a;
    return *this;
  }
  mint &operator++() {
    *this += 1;
    return *this;
  }
  mint &operator++(int) {
    *this += 1;
    return *this;
  }
  mint &operator--() {
    *this -= 1;
    return *this;
  }
  mint &operator--(int) {
    *this -= 1;
    return *this;
  }
};
mint operator+(const mint &x, const mint &y) { return mint(x.a) += y; }
mint operator+(const mint &x, const long long &y) { return mint(x.a) += y; }
mint operator+(const long long &x, mint &y) { return mint(x) += y; }
mint operator-(const mint &x, const mint &y) { return mint(x.a) -= y; }
mint operator-(const mint &x, const long long &y) { return mint(x.a) -= y; }
mint operator-(const long long &x, const mint &y) { return mint(x) -= y; }
mint operator*(const mint &x, const mint &y) { return mint(x.a) *= y; }
mint operator*(const mint &x, const long long &y) { return mint(x.a) *= y; }
mint operator*(const long long &x, const mint &y) { return mint(x) *= y; }
mint operator/(const mint &x, const mint &y) { return mint(x.a) /= y; }
mint operator/(const mint &x, const long long &y) { return mint(x.a) /= y; }
mint operator/(const long long &x, const mint &y) { return mint(x) /= y; }
bool operator==(const mint &x, const mint &y) { return x.a == y.a; }
bool operator==(const mint &x, const long long &y) { return x.a == y; }
bool operator==(const long long &x, mint &y) { return x == y.a; }
bool operator!=(const mint &x, const mint &y) { return !(x == y); }
bool operator!=(const mint &x, const long long &y) { return !(x == y); }
bool operator!=(const long long &x, mint &y) { return !(x == y); }
istream &operator>>(istream &is, mint &i) {
  is >> i.a;
  return is;
}
ostream &operator<<(ostream &os, const mint &i) {
  os << i.a;
  return os;
}
int main() {
  long long N;
  cin >> N;
  ;
  long long S;
  cin >> S;
  ;
  vector<long long> A(N);
  for (auto &i : A) cin >> i;
  ;
  vector<vector<mint>> dp(N + 1, vector<mint>(S + 1));
  for (long long i = 0; i < (N); ++i) {
    for (long long j = S; j >= 0; --j) {
      dp[i + 1][j] = dp[i][j] + dp[i][max(0LL, j - A[i])];
    }
    dp[i + 1][A[i]] += i + 1;
  }
  mint ans;
  for (long long i = 1; i <= (N); ++i) {
    ans += dp[i][S];
  }
  cout << (ans) << endl;
  ;
}
