#include <bits/stdc++.h>
using namespace std;
const int vx[4] = {0, 1, 0, -1};
const int vy[4] = {1, 0, -1, 0};
struct Mint {
  long long x;
  Mint() : x(0) {}
  Mint(long long y)
      : x(y >= 0 ? y % 998244353 : (998244353 - (-y) % 998244353) % 998244353) {
  }
  Mint &operator+=(const Mint &p) {
    if ((x += p.x) >= 998244353) x -= 998244353;
    return *this;
  }
  Mint &operator-=(const Mint &p) {
    if ((x += 998244353 - p.x) >= 998244353) x -= 998244353;
    return *this;
  }
  Mint &operator*=(const Mint &p) {
    x = (long long)(1LL * x * p.x % 998244353);
    return *this;
  }
  Mint &operator/=(const Mint &p) {
    *this *= p.inverse();
    return *this;
  }
  Mint operator-() const { return Mint(-x); }
  Mint operator+(const Mint &p) const { return Mint(*this) += p; }
  Mint operator-(const Mint &p) const { return Mint(*this) -= p; }
  Mint operator*(const Mint &p) const { return Mint(*this) *= p; }
  Mint operator/(const Mint &p) const { return Mint(*this) /= p; }
  bool operator==(const Mint &p) const { return x == p.x; }
  bool operator!=(const Mint &p) const { return x != p.x; }
  Mint inverse() const {
    long long a = x, b = 998244353, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return Mint(u);
  }
  Mint power(long long n) const {
    Mint ret(1), mul(x);
    while (n > 0) {
      if (n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  friend ostream &operator<<(ostream &os, const Mint &p) { return os << p.x; }
  friend istream &operator>>(istream &is, Mint &a) {
    long long t;
    is >> t;
    a = Mint(t);
    return (is);
  }
};
using mint = Mint;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  long long n, s;
  cin >> n >> s;
  vector<long long> a(n);
  for (long long i = (long long)0; i < (long long)n; i++) {
    cin >> a[i];
  }
  vector<Mint> c(s + 1);
  Mint ans = 0;
  for (long long i = (long long)0; i < (long long)n; i++) {
    c[0] += i + 1;
    long long t = s - a[i];
    if (t < 0) continue;
    ans += c[t] * (n - i);
    c[0] -= i + 1;
    for (long long j = (long long)s - a[i]; j >= (long long)0; j--) {
      c[j + a[i]] += c[j];
    }
    c[a[i]] += i + 1;
  }
  cout << ans << endl;
}
