#include <bits/stdc++.h>
using namespace std;
long long power(long long b, long long e, long long m) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b % m, e / 2, m) % m;
  return power(b * b % m, e / 2, m);
}
long long power(long long b, long long e) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b, e / 2);
  return power(b * b, e / 2);
}
const int N = 3002;
long long dp[N][N];
int _runtimeTerror_() {
  long long n, s, i, j;
  cin >> n >> s;
  long long ans = 0, a[n];
  for (i = 0; i < n; ++i) cin >> a[i];
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  for (i = 0; i < n; ++i) {
    if (a[i] == s) {
      ans = (ans + (n - i) * (i + 1)) % 998244353;
      continue;
    }
    for (j = s; j >= 0; --j) {
      if (i > 0) dp[i][j] = dp[i - 1][j];
    }
    for (j = s; j > 0; --j) {
      if (j + a[i] < s && dp[i][j] != -1) {
        if (dp[i][j + a[i]] == -1) ++dp[i][a[i] + j];
        dp[i][j + a[i]] += dp[i][j];
        dp[i][j + a[i]] %= 998244353;
      } else if (j + a[i] == s && dp[i][j] != -1) {
        ans += dp[i][j] * (n - i) % 998244353;
        ans %= 998244353;
      }
    }
    if (dp[i][a[i]] == -1) ++dp[i][a[i]];
    dp[i][a[i]] = (dp[i][a[i]] + i + 1) % 998244353;
  }
  cout << ans % 998244353 << "\n";
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) _runtimeTerror_();
  return 0;
}
