#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long n) {
  a %= 1000000007;
  if (n == 1) return a;
  if (n == 0) return 1;
  if (n % 2)
    return (a * (power((a * a) % 1000000007, n / 2) % 1000000007)) % 1000000007;
  return power((a * a) % 1000000007, n / 2) % 1000000007;
}
const long long inf = (long long)1e18;
long long inverse(long long x) { return power(x, 1000000007 - 2) % 1000000007; }
const long long md = 998244353;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, s;
  cin >> n >> s;
  vector<long long> v(n + 5);
  for (long long i = 1; i < n + 1; ++i) cin >> v[i];
  long long ans = 0, dp[n + 5][3005];
  memset(dp, 0, sizeof dp);
  for (long long i = 1; i < n + 1; ++i) dp[i][0] = n - i + 1;
  for (long long i = n; i > 0; --i) {
    for (long long j = 1; j < 3005; ++j) {
      dp[i][j] = dp[i + 1][j];
      if (j == v[i]) dp[i][j] += n - i + 1, dp[i][j] %= md;
      if (j > v[i]) dp[i][j] += dp[i + 1][j - v[i]], dp[i][j] %= md;
    }
  }
  for (long long i = 1; i < n + 1; ++i)
    if (s >= v[i]) ans += (dp[i + 1][s - v[i]] * i) % md, ans %= md;
  cout << ans % md;
  return 0;
}
