#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
template <typename T, typename U>
static inline void amin(T& x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
static inline void amax(T& x, U y) {
  if (x < y) x = y;
}
long long max(long long a, long long b) { return (a > b) ? a : b; }
long long min(long long a, long long b) { return (a < b) ? a : b; }
const long long N = 1e3 + 10;
long long dp[N][N];
long long solve() {
  dp[0][0] = 1;
  long long ans = 0;
  long long n;
  cin >> n;
  long long s;
  cin >> s;
  long long a[n];
  for (long long i = 0; i < n; ++i) cin >> a[i];
  for (long long i = 0, left = 1, right = n; i < n; i++, left++, right--) {
    if (a[i] == s) {
      ans = (ans + left * right) % 998244353;
    } else if (a[i] < s) {
      dp[i + 1][a[i]] = left;
    }
    for (long long sum = 1; sum < s; sum++) {
      if (sum + a[i] == s) {
        ans += (dp[i][sum] * right) % 998244353;
        ans %= 998244353;
      } else if (sum + a[i] < s) {
        dp[i + 1][sum + a[i]] += dp[i][sum];
      }
    }
    for (long long sum = 0; sum < s; sum++) {
      dp[i + 1][sum] = (dp[i + 1][sum] + dp[i][sum]) % 998244353;
    }
  }
  cout << ans << '\n';
  return 0;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
