#include <bits/stdc++.h>
using namespace std;
const int inf = ~0u >> 2;
const long long INF = ~0ull >> 2;
long long read() {
  long long x;
  if (scanf("%lld", &x) == -1) exit(0);
  return x;
}
const double err = 1e-11;
const double pi = acos(-1);
double readf() {
  double x;
  if (scanf("%lf", &x) == -1) exit(0);
  return x;
}
template <typename T>
T sqr(const T &x) {
  return x * x;
}
template <typename A, typename B>
ostream &operator<<(ostream &o, const pair<A, B> &x) {
  return o << '(' << x.first << ',' << x.second << ')';
}
const int N = 3010;
const int mod = (0 ? 1000000007 : 998244353);
long long mul(long long a, long long b, long long m = mod) { return a * b % m; }
long long qpow(long long a, long long b, long long m = mod) {
  long long ans = 1;
  for (; b; a = mul(a, a, m), b >>= 1)
    if (b & 1) ans = mul(ans, a, m);
  return ans;
}
long long getinv(long long v, long long m = mod) { return qpow(v, m - 2, m); }
long long n, s;
long long dp[N], a[N];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  for (long long i = (0), _ = (n); i < _; i++) cin >> a[i];
  for (long long i = (0), _ = (n); i < _; i++)
    for (long long j = (s - a[i] + 1) - 1, _ = (0); j >= _; j--) {
      if (j == 0)
        dp[a[i]] += i + 1;
      else if (j + a[i] == s)
        dp[s] += dp[j] * (n - i);
      else
        dp[j + a[i]] += dp[j];
      dp[j + a[i]] %= mod;
    }
  cout << dp[s] << endl;
  return 0;
}
